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

Visu image complexe

parent 49a80586
......@@ -50,6 +50,9 @@ class ITK_EXPORT ImageViewer
typedef ImageViewerBase<TPixel,TLabel> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef typename Superclass::ViewModelType ViewModelType;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
......
......@@ -35,7 +35,7 @@ namespace otb
if(m_HistogramWindow!=NULL)
{
m_HistogramWindow->remove(this->GetRedHistogramWidget());
if(this->GetFullWidget()->GetViewModelIsRGB())
if(this->GetFullWidget()->GetViewModel() == Superclass::ScrollWidgetType::RGB)
{
m_HistogramWindow->remove(this->GetGreenHistogramWidget());
m_HistogramWindow->remove(this->GetBlueHistogramWidget());
......@@ -99,7 +99,7 @@ namespace otb
oss.str("");
oss<<this->GetLabel()<<" - Histograms and transfert functions";
if(this->GetFullWidget()->GetViewModelIsRGB())
if(this->GetViewModel() == Superclass::ScrollWidgetType::RGB)
{
m_HistogramWindow = new Fl_Window(0,hfull,3*this->GetRedHistogramWidget()->w(),this->GetRedHistogramWidget()->h());
m_HistogramWindow->add(this->GetRedHistogramWidget());
......
......@@ -101,6 +101,7 @@ namespace otb
typedef typename ImageType::RegionType RegionType;
typedef typename ImageType::OffsetType OffsetType;
typedef typename ScrollWidgetType::VectorPixelType VectorPixelType;
typedef typename ScrollWidgetType::ViewModelType ViewModelType;
typedef typename ScrollWidgetType::Pointer ScrollWidgetPointerType;
typedef typename ZoomWidgetType::Pointer ZoomWidgetPointerType;
typedef typename FullWidgetType::Pointer FullWidgetPointerType;
......@@ -108,7 +109,7 @@ namespace otb
typedef itk::ImageRegionConstIterator< ImageType > InputIteratorType;
typedef itk::Vector<typename ImageType::ValueType,1> MeasurementVectorType;
typedef itk::Vector<typename itk::NumericTraits<InputPixelType>::RealType,1> MeasurementVectorType;
typedef itk::Statistics::ListSample<MeasurementVectorType> ListSampleType;
typedef float HistogramMeasurementType;
typedef itk::Statistics::ListSampleToHistogramGenerator<ListSampleType,HistogramMeasurementType,
......@@ -321,17 +322,13 @@ namespace otb
/**
* \return true if view model is RGB
*/
virtual bool GetViewModelIsRGB(void);
/**
* \return true if the rgb view model is allowed
*/
virtual bool IsRGBViewModelAllowed(void);
virtual ViewModelType GetViewModel(void);
/**
* Set the view model
* \param flag True to turn on RGB view model
*/
virtual void SetViewModelIsRGB(bool flag);
virtual void SetViewModel(ViewModelType viewModel);
/**
* Initialize view model
......
......@@ -93,10 +93,7 @@ namespace otb
sl->Reserve(m_InputImage->GetNumberOfComponentsPerPixel());
for(unsigned int i = 0;i<m_InputImage->GetNumberOfComponentsPerPixel();++i)
{
sl->PushBack(ListSampleType::New());
}
InputIteratorType it;
// if scroll is activated, compute the factors from the quicklook
if(m_UseScroll)
......@@ -114,19 +111,55 @@ namespace otb
it.GoToBegin();
}
while( !it.IsAtEnd() )
if(this->GetViewModel() == ScrollWidgetType::COMPLEX_MODULUS)
{
sl->PushBack(ListSampleType::New());
while( !it.IsAtEnd() )
{
PixelType pixel = it.Get();
for(unsigned int i = 0;i<m_InputImage->GetNumberOfComponentsPerPixel();++i)
{
sl->GetNthElement(0)->PushBack(vcl_sqrt(pixel[m_RedChannelIndex]*pixel[m_RedChannelIndex]+pixel[m_GreenChannelIndex]*pixel[m_GreenChannelIndex]));
}
++it;
}
}
else if(this->GetViewModel() == ScrollWidgetType::COMPLEX_PHASE)
{
sl->PushBack(ListSampleType::New());
while( !it.IsAtEnd() )
{
PixelType pixel = it.Get();
for(unsigned int i = 0;i<m_InputImage->GetNumberOfComponentsPerPixel();++i)
{
sl->GetNthElement(0)->PushBack(vcl_atan2(pixel[m_RedChannelIndex],pixel[m_GreenChannelIndex]));
}
++it;
}
}
else
{
PixelType pixel = it.Get();
for(unsigned int i = 0;i<m_InputImage->GetNumberOfComponentsPerPixel();++i)
{
sl->GetNthElement(i)->PushBack(pixel[i]);
sl->PushBack(ListSampleType::New());
}
while( !it.IsAtEnd() )
{
PixelType pixel = it.Get();
for(unsigned int i = 0;i<m_InputImage->GetNumberOfComponentsPerPixel();++i)
{
sl->GetNthElement(0)->PushBack(pixel[i]);
}
++it;
}
++it;
}
m_HistogramGeneratorList->Clear();
m_TransfertFunctionList->Clear();
otbMsgDebugMacro(<<"Nb bands: "<<m_InputImage->GetNumberOfComponentsPerPixel());
for(unsigned int i = 0;i<m_InputImage->GetNumberOfComponentsPerPixel();++i)
for(unsigned int i = 0;i<sl->Size();++i)
{
typename HistogramGeneratorType::Pointer generator = HistogramGeneratorType::New();
generator->SetListSample(sl->GetNthElement(i));
......@@ -142,6 +175,13 @@ namespace otb
m_TransfertFunctionList->Back()->SetLowerBound(static_cast<InputPixelType>(min));
m_TransfertFunctionList->Back()->SetUpperBound(static_cast<InputPixelType>(max));
}
if(m_UseScroll)
{
m_ScrollWidget->SetTransfertFunctionList(m_TransfertFunctionList);
}
m_ZoomWidget->SetTransfertFunctionList(m_TransfertFunctionList);
m_FullWidget->SetTransfertFunctionList(m_TransfertFunctionList);
}
/// Build the HMI
......@@ -303,14 +343,6 @@ namespace otb
// Compute the normalization factors
ComputeNormalizationFactors();
if(m_UseScroll)
{
m_ScrollWidget->SetTransfertFunctionList(m_TransfertFunctionList);
}
m_ZoomWidget->SetTransfertFunctionList(m_TransfertFunctionList);
m_FullWidget->SetTransfertFunctionList(m_TransfertFunctionList);
InitializeViewModel();
......@@ -414,7 +446,7 @@ namespace otb
{
m_RedHistogramWidget->show();
if(this->GetViewModelIsRGB())
if(this->GetViewModel()== ScrollWidgetType::RGB)
{
m_GreenHistogramWidget->show();
m_BlueHistogramWidget->show();
......@@ -452,7 +484,7 @@ namespace otb
m_RedHistogramWidget->hide();
if(this->GetViewModelIsRGB())
if(this->GetViewModel()==ScrollWidgetType::RGB)
{
m_GreenHistogramWidget->hide();
m_BlueHistogramWidget->hide();
......@@ -575,7 +607,7 @@ namespace otb
m_RedHistogramWidget->redraw();
if(this->GetViewModelIsRGB())
if(this->GetViewModel()==ScrollWidgetType::RGB)
{
m_GreenHistogramWidget->redraw();
m_BlueHistogramWidget->redraw();
......@@ -620,8 +652,28 @@ namespace otb
if(m_InputImage->GetBufferedRegion().IsInside(index))
{
//comment: std::cout<<"Index: "<<index<<std::endl;
typename ImageType::PixelType newPixel = m_InputImage->GetPixel(index);
oss<<newPixel<<" ("<<m_Label<<" pixel values)"<<std::endl;
if(this->GetViewModel() == ScrollWidgetType::RGB || this->GetViewModel() == ScrollWidgetType::GRAYSCALE)
{
oss<<newPixel<<" ("<<m_Label<<" pixel values)"<<std::endl;
}
else if(this->GetViewModel() == ScrollWidgetType::COMPLEX_MODULUS)
{
double im = static_cast<double>(newPixel[m_RedChannelIndex]);
double re = static_cast<double>(newPixel[m_GreenChannelIndex]);
double modulus = vcl_sqrt(re*re+im*im);
oss<<modulus<<std::setprecision(3)<<" ("<<m_Label<<" modulus value)"<<std::endl;
}
else if(this->GetViewModel() == ScrollWidgetType::COMPLEX_PHASE)
{
double im = static_cast<double>(newPixel[m_RedChannelIndex]);
double re = static_cast<double>(newPixel[m_GreenChannelIndex]);
double phase = vcl_atan2(im,re);
oss<<phase<<std::setprecision(3)<<" ("<<m_Label<<" phase value)"<<std::endl;
}
}
else
{
......@@ -972,39 +1024,35 @@ ImageViewerBase<TPixel,TLabel>
}
template<class TPixel, class TLabel>
bool
typename ImageViewerBase<TPixel,TLabel>
::ViewModelType
ImageViewerBase<TPixel,TLabel>
::GetViewModelIsRGB()
::GetViewModel()
{
return m_FullWidget->GetViewModelIsRGB();
return m_FullWidget->GetViewModel();
}
template<class TPixel, class TLabel>
bool
ImageViewerBase<TPixel,TLabel>
::IsRGBViewModelAllowed()
{
return (m_InputImage->GetNumberOfComponentsPerPixel()>2);
}
template<class TPixel, class TLabel>
void
ImageViewerBase<TPixel,TLabel>
::SetViewModelIsRGB(bool flag)
::SetViewModel(ViewModelType viewModel)
{
if(flag)
switch(viewModel)
{
if(IsRGBViewModelAllowed())
case ScrollWidgetType::RGB:
{
if(m_InputImage->GetNumberOfComponentsPerPixel()>2)
{
if(m_UseScroll)
{
m_ScrollWidget->SetViewModelToRGB();
m_ScrollWidget->SetViewModel(viewModel);
m_ScrollWidget->SetRedChannelIndex(m_RedChannelIndex);
m_ScrollWidget->SetGreenChannelIndex(m_GreenChannelIndex);
m_ScrollWidget->SetBlueChannelIndex(m_BlueChannelIndex);
}
m_FullWidget->SetViewModelToRGB();
m_ZoomWidget->SetViewModelToRGB();
m_FullWidget->SetViewModel(viewModel);
m_ZoomWidget->SetViewModel(viewModel);
m_ZoomWidget->SetRedChannelIndex(m_RedChannelIndex);
m_ZoomWidget->SetGreenChannelIndex(m_GreenChannelIndex);
m_ZoomWidget->SetBlueChannelIndex(m_BlueChannelIndex);
......@@ -1012,6 +1060,8 @@ ImageViewerBase<TPixel,TLabel>
m_FullWidget->SetGreenChannelIndex(m_GreenChannelIndex);
m_FullWidget->SetBlueChannelIndex(m_BlueChannelIndex);
ComputeNormalizationFactors();
typename HistogramWidgetType::ColorType blue,red,green;
red[0]=0.5;
......@@ -1045,30 +1095,90 @@ ImageViewerBase<TPixel,TLabel>
m_GreenHistogramWidget->SetTransfertFunctionLabel("Affine");
m_GreenHistogramWidget->SetHistogramColor(green);
m_GreenHistogramWidget->SetTextColor(green);
break;
}
}
else
case ScrollWidgetType::GRAYSCALE:
{
if(m_UseScroll)
{
m_ScrollWidget->SetViewModelToGrayscale();
m_ScrollWidget->SetRedChannelIndex(m_RedChannelIndex);
}
m_FullWidget->SetViewModelToGrayscale();
m_ZoomWidget->SetViewModelToGrayscale();
m_ZoomWidget->SetRedChannelIndex(m_RedChannelIndex);
m_FullWidget->SetRedChannelIndex(m_RedChannelIndex);
typename HistogramWidgetType::ColorType gray;
gray.Fill(0.5);
if(m_UseScroll)
{
m_ScrollWidget->SetViewModel(viewModel);
m_ScrollWidget->SetRedChannelIndex(m_RedChannelIndex);
}
m_FullWidget->SetViewModel(viewModel);
m_ZoomWidget->SetViewModel(viewModel);
m_ZoomWidget->SetRedChannelIndex(m_RedChannelIndex);
m_FullWidget->SetRedChannelIndex(m_RedChannelIndex);
m_RedHistogramWidget->SetHistogram(m_HistogramGeneratorList->GetNthElement(m_RedChannelIndex)->GetOutput());
m_RedHistogramWidget->SetTransfertFunction(m_TransfertFunctionList->GetNthElement(m_RedChannelIndex));
m_RedHistogramWidget->SetLabel("Grayscale channel");
m_RedHistogramWidget->SetTransfertFunctionLabel("Affine");
m_RedHistogramWidget->SetHistogramColor(gray);
m_RedHistogramWidget->SetTextColor(gray);
ComputeNormalizationFactors();
typename HistogramWidgetType::ColorType gray;
gray.Fill(0.5);
m_RedHistogramWidget->SetHistogram(m_HistogramGeneratorList->GetNthElement(m_RedChannelIndex)->GetOutput());
m_RedHistogramWidget->SetTransfertFunction(m_TransfertFunctionList->GetNthElement(m_RedChannelIndex));
m_RedHistogramWidget->SetLabel("Grayscale channel");
m_RedHistogramWidget->SetTransfertFunctionLabel("Affine");
m_RedHistogramWidget->SetHistogramColor(gray);
m_RedHistogramWidget->SetTextColor(gray);
break;
}
case ScrollWidgetType::COMPLEX_MODULUS:
{
if(m_UseScroll)
{
m_ScrollWidget->SetViewModel(viewModel);
m_ScrollWidget->SetRedChannelIndex(m_RedChannelIndex);
m_ScrollWidget->SetRedChannelIndex(m_GreenChannelIndex);
}
m_FullWidget->SetViewModel(viewModel);
m_ZoomWidget->SetViewModel(viewModel);
m_ZoomWidget->SetRedChannelIndex(m_RedChannelIndex);
m_FullWidget->SetRedChannelIndex(m_RedChannelIndex);
m_ZoomWidget->SetRedChannelIndex(m_GreenChannelIndex);
m_FullWidget->SetRedChannelIndex(m_GreenChannelIndex);
ComputeNormalizationFactors();
typename HistogramWidgetType::ColorType gray;
gray.Fill(0.5);
m_RedHistogramWidget->SetHistogram(m_HistogramGeneratorList->GetNthElement(0)->GetOutput());
m_RedHistogramWidget->SetTransfertFunction(m_TransfertFunctionList->GetNthElement(0));
m_RedHistogramWidget->SetLabel("Modulus");
m_RedHistogramWidget->SetTransfertFunctionLabel("Affine");
m_RedHistogramWidget->SetHistogramColor(gray);
m_RedHistogramWidget->SetTextColor(gray);
break;
}
case ScrollWidgetType::COMPLEX_PHASE:
{
if(m_UseScroll)
{
m_ScrollWidget->SetViewModel(viewModel);
m_ScrollWidget->SetRedChannelIndex(m_RedChannelIndex);
m_ScrollWidget->SetRedChannelIndex(m_GreenChannelIndex);
}
m_FullWidget->SetViewModel(viewModel);
m_ZoomWidget->SetViewModel(viewModel);
m_ZoomWidget->SetRedChannelIndex(m_RedChannelIndex);
m_FullWidget->SetRedChannelIndex(m_RedChannelIndex);
m_ZoomWidget->SetGreenChannelIndex(m_GreenChannelIndex);
m_FullWidget->SetGreenChannelIndex(m_GreenChannelIndex);
ComputeNormalizationFactors();
typename HistogramWidgetType::ColorType gray;
gray.Fill(0.5);
m_RedHistogramWidget->SetHistogram(m_HistogramGeneratorList->GetNthElement(0)->GetOutput());
m_RedHistogramWidget->SetTransfertFunction(m_TransfertFunctionList->GetNthElement(0));
m_RedHistogramWidget->SetLabel("Phase");
m_RedHistogramWidget->SetTransfertFunctionLabel("Affine");
m_RedHistogramWidget->SetHistogramColor(gray);
m_RedHistogramWidget->SetTextColor(gray);
break;
}
}
}
......@@ -1077,13 +1187,13 @@ void
ImageViewerBase<TPixel,TLabel>
::InitializeViewModel(void)
{
if(this->IsRGBViewModelAllowed())
if(m_InputImage->GetNumberOfComponentsPerPixel()>2)
{
this->SetViewModelIsRGB(true);
this->SetViewModel(ScrollWidgetType::RGB);
}
else
{
this->SetViewModelIsRGB(false);
this->SetViewModel(ScrollWidgetType::GRAYSCALE);
}
}
......@@ -1107,7 +1217,7 @@ ImageViewerBase<TPixel,TLabel>
::ChangeTransfertFunctions(void)
{
m_TransfertFunctionList->SetNthElement(m_RedChannelIndex, m_RedHistogramWidget->GetTransfertFunction());
if(m_FullWidget->GetViewModelIsRGB())
if(m_FullWidget->GetViewModel()==ScrollWidgetType::RGB)
{
m_TransfertFunctionList->SetNthElement(m_BlueChannelIndex, m_BlueHistogramWidget->GetTransfertFunction());
m_TransfertFunctionList->SetNthElement(m_GreenChannelIndex, m_GreenHistogramWidget->GetTransfertFunction());
......
......@@ -58,6 +58,9 @@ class ImageWidgetBase
typedef typename ImageType::IndexType IndexType;
typedef typename ImageType::RegionType RegionType;
/** View model */
enum ViewModelType{GRAYSCALE,COMPLEX_MODULUS,COMPLEX_PHASE,RGB};
/** Form overlay typedef */
typedef ImageWidgetFormBase FormType;
typedef FormType::Pointer FormPointerType;
......@@ -98,7 +101,8 @@ class ImageWidgetBase
itkGetMacro(SubSamplingRate, unsigned int);
itkSetMacro(SubSamplingRate, unsigned int);
itkGetMacro(ViewModelIsRGB,bool);
itkSetMacro(ViewModel,ViewModelType);
itkGetMacro(ViewModel,ViewModelType);
itkGetMacro(ImageOverlayOpacity,unsigned char);
itkSetMacro(ImageOverlayOpacity,unsigned char);
......@@ -136,15 +140,6 @@ class ImageWidgetBase
*/
void SetTransfertFunctionList(TransfertFunctionListType * list);
/**
* Set view mode to RGB.
*/
void SetViewModelToRGB(void);
/**
* Set view mode to Grayscale.
*/
void SetViewModelToGrayscale(void);
/** Show The widget */
void Show(void);
/** Reset the widget (Clear buffered region and re init the transfert functions) */
......@@ -207,8 +202,8 @@ class ImageWidgetBase
RegionType m_BufferedRegion;
/** Viewed image region */
RegionType m_ViewedRegion;
/** Flag for RGB/ GRAYSCALE view mode */
bool m_ViewModelIsRGB;
/** The view model */
ViewModelType m_ViewModel;
/** Red channel index */
unsigned int m_RedChannelIndex;
/** Green channel index */
......
......@@ -43,7 +43,7 @@ ImageWidgetBase<TPixel>
region.SetIndex(index);
m_BufferedRegion = region;
m_ViewedRegion = region;
m_ViewModelIsRGB=true;
m_ViewModel=RGB;
m_RedChannelIndex = 0;
m_GreenChannelIndex = 1;
m_BlueChannelIndex = 2;
......@@ -236,26 +236,6 @@ ImageWidgetBase<TPixel>
{
return m_ImageOverlay;
}
/**
* Set view mode to RGB.
*/
template <class TPixel>
void
ImageWidgetBase<TPixel>
::SetViewModelToRGB(void)
{
m_ViewModelIsRGB=true;
}
/**
* Set view mode to Grayscale.
*/
template <class TPixel>
void
ImageWidgetBase<TPixel>
::SetViewModelToGrayscale(void)
{
m_ViewModelIsRGB=false;
}
/**
* Show The widget.
*/
......@@ -395,20 +375,48 @@ ImageWidgetBase<TPixel>
unsigned int index = 0;
for(it.GoToBegin();!it.IsAtEnd();++it)
{
m_OpenGlBuffer[index] = Normalize(it.Get()[m_RedChannelIndex],m_RedChannelIndex);
if(m_ViewModelIsRGB)
switch(m_ViewModel)
{
m_OpenGlBuffer[index+1] = Normalize(it.Get()[m_GreenChannelIndex],m_GreenChannelIndex);
m_OpenGlBuffer[index+2] = Normalize(it.Get()[m_BlueChannelIndex],m_BlueChannelIndex);
m_OpenGlBuffer[index+3] = 255;
index+=4;
case RGB:
{
m_OpenGlBuffer[index] = Normalize(it.Get()[m_RedChannelIndex],m_RedChannelIndex);
m_OpenGlBuffer[index+1] = Normalize(it.Get()[m_GreenChannelIndex],m_GreenChannelIndex);
m_OpenGlBuffer[index+2] = Normalize(it.Get()[m_BlueChannelIndex],m_BlueChannelIndex);
m_OpenGlBuffer[index+3] = 255;
index+=4;
break;
}
case GRAYSCALE:
{
unsigned char gray = Normalize(it.Get()[m_RedChannelIndex],m_RedChannelIndex);
m_OpenGlBuffer[index] = gray;
m_OpenGlBuffer[index+1] = gray;
m_OpenGlBuffer[index+2] = gray;
m_OpenGlBuffer[index+3] = 255;
index+=4;
break;
}
else
case COMPLEX_MODULUS:
{
m_OpenGlBuffer[index+1] = Normalize(it.Get()[m_RedChannelIndex],m_RedChannelIndex);
m_OpenGlBuffer[index+2] = Normalize(it.Get()[m_RedChannelIndex],m_RedChannelIndex);
unsigned char modulus = Normalize(vcl_sqrt(it.Get()[m_RedChannelIndex]*it.Get()[m_RedChannelIndex]
+it.Get()[m_GreenChannelIndex]*it.Get()[m_GreenChannelIndex]),0);
m_OpenGlBuffer[index] = modulus;
m_OpenGlBuffer[index+1] = modulus;
m_OpenGlBuffer[index+2] = modulus;
m_OpenGlBuffer[index+3] = 255;
index+=4;
index+=4;
break;
}
case COMPLEX_PHASE:
{
unsigned char phase = Normalize(vcl_atan2(it.Get()[m_RedChannelIndex],it.Get()[m_GreenChannelIndex]),0);
m_OpenGlBuffer[index] = phase;
m_OpenGlBuffer[index+1] = phase;
m_OpenGlBuffer[index+2] = phase;
m_OpenGlBuffer[index+3] = 255;
index+=4;
break;
}
}
}
}
......
......@@ -66,12 +66,12 @@ ADD_TEST(viTuImageViewerNew ${VISU_TESTS1}
ADD_TEST(viTvImageViewerWithOtbVectorImage ${VISU_TESTS1}
otbImageViewer
${INPUTDATA}/couleurs.jpg
${INPUTDATA}/couleurs.jpg 3
)
ADD_TEST(viTvImageViewerWithLargeOtbVectorImage ${VISU_TESTS1}
otbImageViewer
${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF
${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF 0
)
......@@ -80,9 +80,19 @@ ADD_TEST(viTvImageViewerWithOtbImage ${VISU_TESTS1}
${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif
)
ADD_TEST(viTvModulusImageViewerWithComplexImage ${VISU_TESTS1}
otbImageViewer
${IMAGEDATA}/RADARSAT2/SCENE01/DAT_01.001 1
)
ADD_TEST(viTvPhaseImageViewerWithComplexImage ${VISU_TESTS1}
otbImageViewer
${IMAGEDATA}/RADARSAT2/SCENE01/DAT_01.001 2
)
ADD_TEST(viTvImageViewerWithLargeOtbImage ${VISU_TESTS1}
otbImageViewerWithOtbImage
${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF
${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF 0
)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -48,9 +48,13 @@ int otbFixedSizeFullImageWidget( int argc, char * argv[] )
window.resizable(widget.GetPointer());
widget->SetInput(reader->GetOutput());
if(reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3)
widget->SetViewModelToRGB();
{
widget->SetViewModel(WidgetType::RGB);
}
else
widget->SetViewModelToGrayscale();
{
widget->SetViewModel(WidgetType::GRAYSCALE);
}
widget->Init(0,0,size[0],size[1],"Test Full Image Widget");
widget->redraw();
window.end();
......
......@@ -48,9 +48,9 @@ int otbFullResolutionImageWidget( int argc, char * argv[] )
window.resizable(widget.GetPointer());
widget->SetInput(reader->GetOutput());
if(reader->GetOutput()->GetNumberOfComponentsPerPixel()>=3)
widget->SetViewModelToRGB();
widget->SetViewModel(WidgetType::RGB);
else
widget->SetViewModelToGrayscale();
widget->SetViewModel(WidgetType::GRAYSCALE);
widget->SetUpperLeftCorner(index);
widget->Init(0,0,size[0],size[1],"Test Full Resolution Widget");
widget->redraw();
......
......@@ -30,8 +30,11 @@ int otbImageViewer( int argc, char * argv[] )
typedef double PixelType;
typedef otb::ImageViewer<PixelType> ImageViewerType;
typedef ImageViewerType::ImageType ImageType;
typedef ImageViewerType::ViewModelType ViewModelType;
typedef otb::ImageFileReader<ImageType> ReaderType;
ViewModelType mode = static_cast<ViewModelType>(atoi(argv[2]));
// instantiation
ImageViewerType::Pointer viewer = ImageViewerType::New();
......@@ -39,12 +42,15 @@ int otbImageViewer( int argc, char * argv[] )
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(filename);