Commit 55868377 authored by Julien Michel's avatar Julien Michel
Browse files

evolutions viewer

parent dcec393d
......@@ -478,23 +478,23 @@ void GDALImageIO::InternalReadImageInformation()
/* -------------------------------------------------------------------- */
// Default Spacing
m_Spacing[0]=1;
m_Spacing[1]=1;
m_Spacing[0]=1;
m_Spacing[1]=1;
if(m_NumberOfDimensions==3)
m_Spacing[2]=1;
char** papszMetadata;
papszMetadata = m_poDataset->GetMetadata( NULL );
const char *pszValue;
// const char *pszValue;
pszValue = CSLFetchNameValue( papszMetadata, "CEOS_LINE_SPACING_METERS" );
if ( pszValue != NULL )
m_Spacing[0] = atof( pszValue );
// pszValue = CSLFetchNameValue( papszMetadata, "CEOS_LINE_SPACING_METERS" );
// if ( pszValue != NULL )
// m_Spacing[0] = atof( pszValue );
pszValue = CSLFetchNameValue( papszMetadata, "CEOS_PIXEL_SPACING_METERS" );
if ( pszValue != NULL )
m_Spacing[1] = atof( pszValue );
// pszValue = CSLFetchNameValue( papszMetadata, "CEOS_PIXEL_SPACING_METERS" );
// if ( pszValue != NULL )
// m_Spacing[1] = atof( pszValue );
......@@ -560,10 +560,10 @@ void GDALImageIO::InternalReadImageInformation()
itk::EncapsulateMetaData<unsigned int>(dico, MetaDataKey::m_GCPCountKey,
static_cast<unsigned int>( m_poDataset->GetGCPCount() ) );
double minGCPRow(m_width);
double minGCPCol(m_height);
double minGCPX;
double minGCPY;
// double minGCPRow(m_width);
// double minGCPCol(m_height);
// double minGCPX;
// double minGCPY;
for( int cpt = 0; cpt < m_poDataset->GetGCPCount(); cpt++ )
......@@ -575,14 +575,14 @@ void GDALImageIO::InternalReadImageInformation()
OTB_GCP pOtbGCP(psGCP);
// Origin
if ( ( psGCP->dfGCPLine < minGCPRow ) &&
( psGCP->dfGCPPixel < minGCPCol ) )
{
minGCPRow = psGCP->dfGCPLine;
minGCPCol = psGCP->dfGCPPixel;
minGCPX = psGCP->dfGCPX;
minGCPY = psGCP->dfGCPY;
}
// if ( ( psGCP->dfGCPLine < minGCPRow ) &&
// ( psGCP->dfGCPPixel < minGCPCol ) )
// {
// minGCPRow = psGCP->dfGCPLine;
// minGCPCol = psGCP->dfGCPPixel;
// minGCPX = psGCP->dfGCPX;
// minGCPY = psGCP->dfGCPY;
// }
// Complete the key with the GCP number : GCP_i
::itk::OStringStream lStream;
......@@ -593,8 +593,8 @@ void GDALImageIO::InternalReadImageInformation()
}
m_Origin[0] = minGCPX;
m_Origin[1] = minGCPY;
// m_Origin[0] = minGCPX;
// m_Origin[1] = minGCPY;
}
......@@ -605,12 +605,18 @@ void GDALImageIO::InternalReadImageInformation()
double adfGeoTransform[6];
VectorType VadfGeoTransform;
if( m_poDataset->GetGeoTransform( adfGeoTransform ) == CE_None )
{
if( m_poDataset->GetGeoTransform( adfGeoTransform ) == CE_None )
{
for(int cpt = 0 ; cpt < 6 ; cpt++ ) VadfGeoTransform.push_back(adfGeoTransform[cpt]);
itk::EncapsulateMetaData<VectorType>(dico, MetaDataKey::m_GeoTransformKey, VadfGeoTransform);
}
/// retrieve orgin and spacing from the geo transform
m_Origin[0]=VadfGeoTransform[0];
m_Origin[1]=VadfGeoTransform[3];
m_Spacing[0]=VadfGeoTransform[1];
m_Spacing[1]=VadfGeoTransform[5];
}
/* -------------------------------------------------------------------- */
/* Report metadata. */
......@@ -975,13 +981,14 @@ void GDALImageIO::InternalWriteImageInformation()
char** papszMetadata;
papszMetadata = m_poDataset->GetMetadata( NULL );
itk::OStringStream oss;
oss.str("");
oss<<m_Spacing[0];
CSLSetNameValue( papszMetadata, "CEOS_LINE_SPACING_METERS",oss.str().c_str());
oss.str("");
oss<<m_Spacing[1];
CSLSetNameValue( papszMetadata, "CEOS_PIXEL_SPACING_METERS",oss.str().c_str());
oss.str("");
// oss.str("");
// oss<<m_Spacing[0];
// CSLSetNameValue( papszMetadata, "CEOS_LINE_SPACING_METERS",oss.str().c_str());
// oss.str("");
// oss<<m_Spacing[1];
// CSLSetNameValue( papszMetadata, "CEOS_PIXEL_SPACING_METERS",oss.str().c_str());
// oss.str("");
/* -------------------------------------------------------------------- */
/* Set the projection coordinate system of the image : ProjectionRef */
......@@ -1000,7 +1007,7 @@ void GDALImageIO::InternalWriteImageInformation()
GDAL_GCP * gdalGcps = new GDAL_GCP[gcpCount+1];
bool gcpHasOrigin = false;
// bool gcpHasOrigin = false;
for(unsigned int gcpIndex = 0; gcpIndex < gcpCount;++gcpIndex)
{
......@@ -1011,7 +1018,7 @@ void GDALImageIO::InternalWriteImageInformation()
gdalGcps[gcpIndex].dfGCPX = ImageBase::GetGCPX(dico,gcpIndex);
gdalGcps[gcpIndex].dfGCPY = ImageBase::GetGCPY(dico,gcpIndex);
gdalGcps[gcpIndex].dfGCPZ = ImageBase::GetGCPZ(dico,gcpIndex);
gcpHasOrigin = ImageBase::GetGCPCol(dico,gcpIndex)==0 && ImageBase::GetGCPRow(dico,gcpIndex)==0;
// gcpHasOrigin = ImageBase::GetGCPCol(dico,gcpIndex)==0 && ImageBase::GetGCPRow(dico,gcpIndex)==0;
}
gdalGcps[gcpCount].pszId = const_cast<char*>(std::string("Origin").c_str());
gdalGcps[gcpCount].pszInfo = const_cast<char*>(std::string("Origin gcp added by OTB").c_str());
......@@ -1021,15 +1028,15 @@ void GDALImageIO::InternalWriteImageInformation()
gdalGcps[gcpCount].dfGCPY = m_Origin[1];
gdalGcps[gcpCount].dfGCPZ = 0;
if(gcpHasOrigin)
{
// if(gcpHasOrigin)
// {
m_poDataset->SetGCPs(gcpCount,gdalGcps,ImageBase::GetGCPProjection(dico).c_str());
}
else
{
otbMsgDebugMacro(<<"GCPs do not contain origin.");
m_poDataset->SetGCPs(gcpCount+1,gdalGcps,ImageBase::GetGCPProjection(dico).c_str());
}
// }
// else
// {
// otbMsgDebugMacro(<<"GCPs do not contain origin.");
// m_poDataset->SetGCPs(gcpCount+1,gdalGcps,ImageBase::GetGCPProjection(dico).c_str());
// }
delete [] gdalGcps;
/* -------------------------------------------------------------------- */
......@@ -1041,6 +1048,11 @@ void GDALImageIO::InternalWriteImageInformation()
{
double * geoTransform = new double[6];
std::vector<double> transformVector = ImageBase::GetGeoTransform(dico);
/// Reporting origin and spacing
transformVector[0]=m_Origin[0];
transformVector[3]=m_Origin[1];
transformVector[2]=m_Spacing[0];
transformVector[5]=m_Spacing[1];
for(unsigned int i=0; i<6;++i)
{
......
......@@ -28,9 +28,12 @@ PURPOSE. See the above copyright notices for more information.
#include "otbVectorImageToImageListFilter.h"
#include "otbImage.h"
#include "itkWindowedSincInterpolateImageFunction.h"
#include "otbWindowedSincInterpolateImageGaussianFunction.h"
#include "otbWindowedSincInterpolateImageHammingFunction.h"
#include "itkZeroFluxNeumannBoundaryCondition.h"
#include <FL/gl.h>
#include "itkImageRegionSplitter.h"
#include "otbProlateInterpolateImageFunction.h"
namespace otb
{
......@@ -79,8 +82,11 @@ class ITK_EXPORT ImageAlternateViewer
typedef BSplineInterpolateImageFunction<SingleImageType,double,double> BSplineInterpolatorType;
typedef itk::Function::HammingWindowFunction<4> WindowFunctionType;
typedef otb::Function::GaussianWindowFunction<> GaussianWindowType;
typedef itk::ZeroFluxNeumannBoundaryCondition<SingleImageType> ConditionType;
typedef itk::WindowedSincInterpolateImageFunction<SingleImageType,3,WindowFunctionType,ConditionType ,double> WindowedSincInterpolatorType;
typedef WindowedSincInterpolateImageGaussianFunction<SingleImageType,ConditionType> OtbWindowedSincInterpolatorType;
typedef ProlateInterpolateImageFunction<SingleImageType,ConditionType> ProlateInterpolatorType;
typedef itk::ImageRegionSplitter<2> SplitterType;
typedef typename SplitterType::Pointer SplitterPointerType;
......@@ -90,7 +96,7 @@ class ITK_EXPORT ImageAlternateViewer
itkSetMacro(GreenChannelIndex,unsigned int);
itkGetMacro(GreenChannelIndex,unsigned int);
itkSetMacro(BlueChannelIndex,unsigned int);
itkGetMacro(BlueChannelIndex,unsigned int);
......
......@@ -54,12 +54,15 @@ namespace otb
typename BSplineInterpolatorType::Pointer bsplineInterpolator = BSplineInterpolatorType::New();
bsplineInterpolator->SetSplineOrder(3);
typename ProlateInterpolatorType::Pointer prolateInterpolator = ProlateInterpolatorType::New();
prolateInterpolator->SetRadius(8);
typename OtbWindowedSincInterpolatorType::Pointer otbwinsinc = OtbWindowedSincInterpolatorType::New();
otbwinsinc->SetRadius(8);
// m_ZoomInInterpolator = WindowedSincInterpolatorType::New();
m_ZoomInInterpolator=bsplineInterpolator;
m_ZoomInInterpolator=prolateInterpolator;
// m_ZoomInInterpolator=bsplineInterpolator;
m_ZoomOutInterpolator = bsplineInterpolator;
m_ZoomOutInterpolator = prolateInterpolator;
IndexType index;
SizeType size;
......
......@@ -26,6 +26,7 @@ PURPOSE. See the above copyright notices for more information.
#include "otbStreamingShrinkImageFilter.h"
#include "otbImageWidgetBoxForm.h"
#include "otbImageWidgetPolygonForm.h"
#include "otbImageWidgetCircleForm.h"
#include "itkListSample.h"
#include "otbObjectList.h"
#include "itkCovarianceCalculator.h"
......@@ -131,11 +132,15 @@ class ITK_EXPORT ImageViewer
/// type for the list of the polygon ROI
typedef otb::Polygon<> PolygonType;
typedef typename PolygonType::VertexListIteratorType PolygonIteratorType;
typedef otb::ObjectList<PolygonType> PolygonListType;
typedef typename PolygonListType::Pointer PolygonListPointerType;
typedef typename PolygonListType::Iterator PolygonListIteratorType;
typedef ImageWidgetPolygonForm<> ImageWidgetPolygonFormType;
typedef typename ImageWidgetPolygonFormType::Pointer ImageWidgetPolygonFormPointerType;
typedef typename ImageWidgetPolygonFormType::ColorType ColorType;
typedef ImageWidgetCircleForm ImageWidgetCircleFormType;
typedef typename ImageWidgetCircleFormType::Pointer ImageWidgetCircleFormPointerType;
/// Accessors
itkGetMacro(Built,bool);
......@@ -160,6 +165,10 @@ class ITK_EXPORT ImageViewer
itkGetConstReferenceMacro(MaxComponentValue,VectorPixelType);
itkGetConstReferenceMacro(ZoomWidget,ZoomWidgetPointerType);
itkGetObjectMacro(InterfaceBoxesList,FormListType);
itkSetMacro(InterfaceBoxesColor,ColorType);
itkGetMacro(InterfaceBoxesColor,ColorType);
itkSetMacro(NextROIColor,ColorType);
itkGetMacro(NextROIColor,ColorType);
/** Set the input image (VectorImage version) */
virtual void SetImage(ImageType * img);
......@@ -334,8 +343,6 @@ protected:
ShrinkFilterPointerType m_Shrink;
/// The shrink factor
unsigned int m_ShrinkFactor;
/// Color of the boxes
ColorType m_Color;
/// true if the Gui has been built.
bool m_Built;
......@@ -372,6 +379,12 @@ protected:
/// Interface boxes
FormListPointerType m_InterfaceBoxesList;
/// Next ROI color
ColorType m_NextROIColor;
/// Interfaces box color
ColorType m_InterfaceBoxesColor;
};
......
......@@ -41,10 +41,14 @@ namespace otb
m_ZoomMaxInitialSize = 200;
m_ImageGeometry = 1.0;
m_ScrollLimitSize = 600;
m_Color[0]=1.0;
m_Color[1]=0;
m_Color[2]=0;
m_Color[3]=1.0;
m_InterfaceBoxesColor[0]=1.0;
m_InterfaceBoxesColor[1]=0;
m_InterfaceBoxesColor[2]=0;
m_InterfaceBoxesColor[3]=1.0;
m_NextROIColor[0]=0;
m_NextROIColor[1]=0;
m_NextROIColor[2]=1.0;
m_NextROIColor[3]=0.5;
m_ShrinkFactor=1;
m_RedChannelIndex = 0;
m_GreenChannelIndex = 1;
......@@ -173,92 +177,6 @@ namespace otb
m_MinComponentValue[i]=static_cast<typename ImageType::ValueType>(generator->GetOutput()->Quantile(0,m_NormalizationFactor));
m_MaxComponentValue[i]=static_cast<typename ImageType::ValueType>(generator->GetOutput()->Quantile(0,1-m_NormalizationFactor));
}
// TO UNCOMMENT FOR BIASED BUT FAST NORMALISATION
// typedef itk::ImageRegionIterator<ImageType> IteratorType;
// typename ListSampleType::Pointer listSample = ListSampleType::New();
// unsigned int nbComponents = m_InputImage->GetNumberOfComponentsPerPixel();
// listSample->SetMeasurementVectorSize(nbComponents);
// m_MinComponentValue.SetSize(nbComponents);
// m_MaxComponentValue.SetSize(nbComponents);
// VectorPixelType absolutMax;
// VectorPixelType absolutMin;
// absolutMax.SetSize(nbComponents);
// absolutMin.SetSize(nbComponents);
// absolutMax.Fill(0);
// absolutMin.Fill(0);
// IteratorType it;
// // if scroll is activated, compute the factors from the quicklook
// if(m_UseScroll)
// {
// it = IteratorType(m_Shrink->GetOutput(),m_Shrink->GetOutput()->GetLargestPossibleRegion());
// it.GoToBegin();
// }
// // else, compute the factors from the full viewed region
// else
// {
// m_InputImage->SetRequestedRegion(m_FullWidget->GetViewedRegion());
// m_InputImage->PropagateRequestedRegion();
// m_InputImage->UpdateOutputData();
// it = IteratorType(m_InputImage,m_FullWidget->GetViewedRegion());
// it.GoToBegin();
// }
// while(!it.IsAtEnd())
// {
// listSample->PushBack(it.Get());
// for(unsigned int i = 0; i<nbComponents;++i)
// {
// if(it.Get()[i]>absolutMax[i])
// absolutMax[i]=it.Get()[i];
// if(it.Get()[i]<absolutMin[i])
// absolutMin[i]=it.Get()[i];
// }
// ++it;
// }
// otbMsgDebugMacro(<<"Sample list generated.");
// typename CovarianceCalculatorType::Pointer calc = CovarianceCalculatorType::New();
// calc->SetInputSample(listSample);&
// calc->Update();
// otbMsgDebugMacro(<<"Statistics computed.");
// typename CovarianceCalculatorType::OutputType cov = *(calc->GetOutput());
// for(unsigned int i = 0; i<nbComponents;++i)
// {
// m_MinComponentValue[i] = static_cast<InputPixelType>((calc->GetMean())->GetElement(i)-m_NormalizationFactor*vcl_sqrt(cov(i,i)));
// m_MaxComponentValue[i] = static_cast<InputPixelType>((calc->GetMean())->GetElement(i)+m_NormalizationFactor*vcl_sqrt(cov(i,i)));
// if(m_MinComponentValue[i]<absolutMin[i])
// m_MinComponentValue[i]=absolutMin[i];
// if(m_MaxComponentValue[i]>absolutMax[i])
// m_MaxComponentValue[i]=absolutMax[i];
// }
// END
//TO UNCOMMENT TO HAVE THE SAME MEAN NORMALIZATION FACTOR FOR EACH BAND
// InputPixelType min,max;
// max = (m_MaxComponentValue[m_RedChannelIndex]
// +m_MaxComponentValue[m_GreenChannelIndex]
// +m_MaxComponentValue[m_BlueChannelIndex])/3;
// min = (m_MinComponentValue[m_RedChannelIndex]
// +m_MinComponentValue[m_GreenChannelIndex]
// +m_MinComponentValue[m_BlueChannelIndex])/3;
// TO UNCOMMENT TO HAVE THE MIN AND MAX NORMALIZATION FACTOR FOR THE WHOLE SET OF BANDS
// otbMsgDebugMacro(<<"Normalization between: "<<m_MinComponentValue<<" and "<<m_MaxComponentValue);
// for(unsigned int i = 1; i<nbComponents;++i)
// {
// if(min>m_MinComponentValue[i])
// min=m_MinComponentValue[i];
// if(max<m_MaxComponentValue[i])
// max=m_MaxComponentValue[i];
// }
// m_MinComponentValue.Fill(min);
// m_MaxComponentValue.Fill(max);
// END
// otbMsgDebugMacro(<<"Data min: "<<absolutMin<<", Data max: "<<absolutMax);
otbMsgDebugMacro(<<"Normalization between: "<<m_MinComponentValue<<" and "<<m_MaxComponentValue);
}
......@@ -315,7 +233,6 @@ namespace otb
m_ZoomWidget->Init(0,0,m_ZoomMaxInitialSize,m_ZoomMaxInitialSize,"");
m_ZoomWidget->box( FL_EMBOSSED_BOX );
m_ZoomWidget->SetFormOverlayVisible(true);
m_ZoomWidget->SetFormListOverlay(m_FullWidget->GetFormList());
// Create the zoom selection mode
......@@ -328,7 +245,7 @@ namespace otb
zoomBoxIndex[1]=(m_ZoomWidget->GetViewedRegion().GetIndex()[1]);
zoomBox->SetIndex(zoomBoxIndex);
zoomBox->SetSize(zoomBoxSize);
zoomBox->SetColor(m_Color);
zoomBox->SetColor(m_InterfaceBoxesColor);
m_InterfaceBoxesList->PushBack(zoomBox);
// decide wether to use scroll view or not
......@@ -396,7 +313,7 @@ namespace otb
otbMsgDebugMacro(<<"Scroll box: "<<scrollBoxIndex<<" "<<scrollBoxSize);
box->SetSize(scrollBoxSize);
box->SetIndex(scrollBoxIndex);
box->SetColor(m_Color);
box->SetColor(m_InterfaceBoxesColor);
m_InterfaceBoxesList->PushBack(box);
}
......@@ -425,10 +342,9 @@ namespace otb
InitializeViewModel();
GenerateOverlayList();
m_Built=true;
// Built done
// otbMsgDebugMacro(<<"Leaving build method");
}
/// Set the image (VectorImage version)
template <class TPixel>
......@@ -538,8 +454,30 @@ namespace otb
{
FormListPointerType new_list = FormListType::New();
BoxPointerType zoomBox = BoxType::New();
SizeType zoomBoxSize;
IndexType zoomBoxIndex;
zoomBoxSize[0]=(m_ZoomWidget->GetViewedRegion().GetSize()[0]);
zoomBoxSize[1]=(m_ZoomWidget->GetViewedRegion().GetSize()[1]);
zoomBoxIndex[0]=(m_ZoomWidget->GetViewedRegion().GetIndex()[0]);
zoomBoxIndex[1]=(m_ZoomWidget->GetViewedRegion().GetIndex()[1]);
zoomBox->SetIndex(zoomBoxIndex);
zoomBox->SetSize(zoomBoxSize);
zoomBox->SetColor(m_InterfaceBoxesColor);
m_InterfaceBoxesList->SetNthElement(0,zoomBox);
BoxPointerType box = BoxType::New();
SizeType scrollBoxSize;
IndexType scrollBoxIndex;
scrollBoxSize[0]=(m_FullWidget->GetViewedRegion().GetSize()[0]);
scrollBoxSize[1]=(m_FullWidget->GetViewedRegion().GetSize()[1]);
scrollBoxIndex[0]=(m_FullWidget->GetViewedRegion().GetIndex()[0]);
scrollBoxIndex[1]=(m_FullWidget->GetViewedRegion().GetIndex()[1])+1;
box->SetSize(scrollBoxSize);
box->SetIndex(scrollBoxIndex);
box->SetColor(m_InterfaceBoxesColor);
m_InterfaceBoxesList->SetNthElement(1,box);
for(FormListIteratorType it1 = m_InterfaceBoxesList->Begin();
it1!=m_InterfaceBoxesList->End();++it1)
{
......@@ -551,7 +489,21 @@ namespace otb
{
ImageWidgetPolygonFormPointerType new_poly = ImageWidgetPolygonFormType::New();
new_poly->SetPolygon(it2.Get());
new_list->PushBack(new_poly);
new_poly->SetColor(m_NextROIColor);
for(PolygonIteratorType pIt = it2.Get()->GetVertexList()->Begin();
pIt != it2.Get()->GetVertexList()->End();++pIt)
{
ImageWidgetCircleFormPointerType new_circle = ImageWidgetCircleFormType::New();
new_circle->SetCenter(pIt.Value());
new_circle->SetRadius(4);
new_circle->SetSolid(false);
new_circle->SetColor(m_InterfaceBoxesColor);
new_list->PushBack(new_circle);
}
new_list->PushBack(new_poly);
}
if(m_UseScroll)
......@@ -576,8 +528,19 @@ namespace otb
UpdateScrollWidget();
UpdateFullWidget();
UpdateZoomWidget();
Fl::check();
// update the linked viewer
typename ViewerListType::Iterator linkedIt = m_LinkedViewerList->Begin();
typename OffsetListType::iterator offIt = m_LinkedViewerOffsetList.begin();
while(linkedIt!=m_LinkedViewerList->End()&&offIt!=m_LinkedViewerOffsetList.end())
{
if(!linkedIt.Get()->GetUpdating())
{
linkedIt.Get()->Update();
}
}
Fl::check();
}
template <class TPixel>
......@@ -626,18 +589,6 @@ namespace otb
ImageViewer<TPixel>
::UpdateFullWidget(void)
{
BoxPointerType zoomBox = BoxType::New();
SizeType zoomBoxSize;
IndexType zoomBoxIndex;
zoomBoxSize[0]=(m_ZoomWidget->GetViewedRegion().GetSize()[0]);
zoomBoxSize[1]=(m_ZoomWidget->GetViewedRegion().GetSize()[1]);
zoomBoxIndex[0]=(m_ZoomWidget->GetViewedRegion().GetIndex()[0]);
zoomBoxIndex[1]=(m_ZoomWidget->GetViewedRegion().GetIndex()[1]);
zoomBox->SetIndex(zoomBoxIndex);
zoomBox->SetSize(zoomBoxSize);
zoomBox->SetColor(m_Color);
std::cout<<"Zoom box: "<<zoomBoxSize<<", "<<zoomBoxIndex<<std::endl;
m_InterfaceBoxesList->SetNthElement(0,zoomBox);
m_FullWidget->redraw();
}
......@@ -647,21 +598,8 @@ namespace otb
::UpdateScrollWidget(void)
{
if(m_UseScroll)
{
BoxPointerType box = BoxType::New();
SizeType scrollBoxSize;
IndexType scrollBoxIndex;
scrollBoxSize[0]=(m_FullWidget->GetViewedRegion().GetSize()[0]);
scrollBoxSize[1]=(m_FullWidget->GetViewedRegion().GetSize()[1]);
scrollBoxIndex[0]=(m_FullWidget->GetViewedRegion().GetIndex()[0]);
scrollBoxIndex[1]=(m_FullWidget->GetViewedRegion().GetIndex()[1])+1;
box->SetSize(scrollBoxSize);
box->SetIndex(scrollBoxIndex);
box->SetColor(m_Color);
std::cout<<"Scroll box: "<<scrollBoxSize<<", "<<scrollBoxIndex<<std::endl;
m_InterfaceBoxesList->SetNthElement(1,box);
{
m_ScrollWidget->redraw();
m_FullWidget->redraw();
}
}
......@@ -721,8 +659,6 @@ ImageViewer<TPixel>
RegionType newRegion = ComputeConstrainedRegion(region,m_InputImage->GetLargestPossibleRegion());
m_FullWidget->SetUpperLeftCorner(newRegion.GetIndex());
this->UpdateScrollWidget();
typename ViewerListType::Iterator linkedIt = m_LinkedViewerList->Begin();
typename OffsetListType::iterator offIt = m_LinkedViewerOffsetList.begin();
......@@ -756,8 +692,6 @@ template <class TPixel>
RegionType newRegion = ComputeConstrainedRegion(region,m_FullWidget->GetViewedRegion());
m_ZoomWidget->SetZoomUpperLeftCorner(newRegion.GetIndex());
this->Update();
typename ViewerListType::Iterator linkedIt = m_LinkedViewerList->Begin();
typename OffsetListType::iterator offIt = m_LinkedViewerOffsetList.begin();
......
......@@ -66,37 +66,305 @@ class ITK_EXPORT ImageViewerFullWidget
typedef ImageWidgetPointForm PointType;
typedef Polygon<> PolygonType;
typedef PolygonType::ContinuousIndexType ContinuousIndexType;
typedef PolygonType::Superclass::Superclass::VertexListPointer VertexListPointerType;
typedef PolygonType::Superclass::Superclass::VertexListType VertexListType;
itkSetMacro(Parent,ParentPointerType);
itkGetMacro(Parent,ParentPointerType);
/** Handle method */
virtual int handle(int event)
{
switch(event)
/** Default mode handling, without ROI selection */
virtual int DefaultHandle(int event)
{
switch(event)
{
case FL_PUSH:
// in case of mouse click, change the point of view
int x = Fl::event_x();
int y = Fl::event_y();
IndexType clickedIndex;
clickedIndex[0]=x;
clickedIndex[1]=y;
clickedIndex=this->WindowToImageCoordinates(clickedIndex);
m_Parent->ChangeZoomViewedRegion(clickedIndex);
m_Parent->Update();
return 1;
case FL_KEYDOWN:
{
int x = Fl::event_x();
int y = Fl::event_y();
IndexType clickedIndex;
clickedIndex[0]=x;
clickedIndex[1]=y;
if (!m_ShortCutRectangle)
{
clickedIndex=this->WindowToImageCoordinates(clickedIndex);
m_Parent->ChangeZoomViewedRegion(clickedIndex);
}
if (!m_Drag)
IndexType newIndex = m_Parent->GetZoomWidget()->GetViewedRegion().GetIndex();
SizeType newSize = m_Parent->GetZoomWidget()->GetViewedRegion().GetSize();
bool moved = false;
switch(Fl::event_key())
{
m_LastIndex=this->WindowToImageCoordinates(clickedIndex);
if (m_ShortCutRectangle)
case FL_Down:
{
m_Drag = false;
}
}
return 1;
}
case FL_ENTER:
newIndex[1] += static_cast<long int>(newSize[1]/2)+newSize[1]/2;
newIndex[0] += newSize[0]/2;
moved = true;
break;
}
case FL_Up:
{
newIndex[1] += -static_cast<long int>(newSize[1]/2)