ENH: Radiometric calibration, switch to the refactored vis
authorEmmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Fri Jun 26 17:54:21 2009 +0800 (14 months ago)
changeset 149660358e087e74
parent 1495 001ba6fd61fa
child 1497 1a47d5765b9a
ENH: Radiometric calibration, switch to the refactored vis
RadiometricCalibration/Controller/otbRadiometricCalibrationController.cxx
RadiometricCalibration/Controller/otbRadiometricCalibrationController.h
RadiometricCalibration/Controller/otbRadiometricCalibrationControllerInterface.h
RadiometricCalibration/Model/otbRadiometricCalibrationModel.cxx
RadiometricCalibration/Model/otbRadiometricCalibrationModel.h
RadiometricCalibration/View/otbRadiometricCalibrationViewGUI.cxx
RadiometricCalibration/View/otbRadiometricCalibrationViewGUI.h
RadiometricCalibration/View/otbRadiometricCalibrationViewGroup.fl
     1.1 --- a/RadiometricCalibration/Controller/otbRadiometricCalibrationController.cxx	Fri Jun 26 17:29:07 2009 +0800
     1.2 +++ b/RadiometricCalibration/Controller/otbRadiometricCalibrationController.cxx	Fri Jun 26 17:54:21 2009 +0800
     1.3 @@ -200,11 +200,11 @@
     1.4  
     1.5  void
     1.6  RadiometricCalibrationController
     1.7 -::UpdateModulusChannelOrder(int realChoice, int imChoice)
     1.8 +::UpdateAmplitudeChannelOrder(int realChoice, int imChoice)
     1.9  {
    1.10    try
    1.11      {
    1.12 -      m_Model->UpdateModulusChannelOrder(realChoice,imChoice);
    1.13 +      m_Model->UpdateAmplitudeChannelOrder(realChoice,imChoice);
    1.14      }
    1.15    catch (itk::ExceptionObject & err)
    1.16      {
     2.1 --- a/RadiometricCalibration/Controller/otbRadiometricCalibrationController.h	Fri Jun 26 17:29:07 2009 +0800
     2.2 +++ b/RadiometricCalibration/Controller/otbRadiometricCalibrationController.h	Fri Jun 26 17:54:21 2009 +0800
     2.3 @@ -109,7 +109,7 @@
     2.4    virtual void SetOutputFileName( const char * name );
     2.5    virtual void UpdateRGBChannelOrder(unsigned int red,unsigned int green,unsigned int blue);
     2.6    virtual void UpdateGrayscaleChannel(unsigned int channel);
     2.7 -  virtual void UpdateModulusChannelOrder(int realChoice , int imChoice);
     2.8 +  virtual void UpdateAmplitudeChannelOrder(int realChoice , int imChoice);
     2.9    virtual void UpdatePhaseChannelOrder(int realChoice , int imChoice);
    2.10    virtual void UpdateDisplay(EnumImageType pType);
    2.11  
     3.1 --- a/RadiometricCalibration/Controller/otbRadiometricCalibrationControllerInterface.h	Fri Jun 26 17:29:07 2009 +0800
     3.2 +++ b/RadiometricCalibration/Controller/otbRadiometricCalibrationControllerInterface.h	Fri Jun 26 17:54:21 2009 +0800
     3.3 @@ -54,7 +54,7 @@
     3.4    virtual void SetOutputFileName( const char * name ) =0;
     3.5    virtual void UpdateRGBChannelOrder(unsigned int red,unsigned int green,unsigned int blue) =0;
     3.6    virtual void UpdateGrayscaleChannel(unsigned int channel) =0;
     3.7 -  virtual void UpdateModulusChannelOrder(int realChoice , int imChoice) = 0; 
     3.8 +  virtual void UpdateAmplitudeChannelOrder(int realChoice , int imChoice) = 0; 
     3.9    virtual void UpdatePhaseChannelOrder(int realChoice , int imChoice) = 0; 
    3.10    virtual void UpdateDisplay(EnumImageType pType) =0;
    3.11    virtual VisuControllerPointerType GetVisuController() =0;
     4.1 --- a/RadiometricCalibration/Model/otbRadiometricCalibrationModel.cxx	Fri Jun 26 17:29:07 2009 +0800
     4.2 +++ b/RadiometricCalibration/Model/otbRadiometricCalibrationModel.cxx	Fri Jun 26 17:54:21 2009 +0800
     4.3 @@ -78,7 +78,6 @@
     4.4  
     4.5    // Init the lists
     4.6    m_ImageLayerList = ImageLayerListType::New();
     4.7 -  m_RenderingFunctionList = StandardRenderingFunctionListType::New();
     4.8  
     4.9    // Init Filters & metadata class
    4.10    m_ImageMetadataInterface = ImageMetadataInterfaceType::New();
    4.11 @@ -100,52 +99,45 @@
    4.12    /// Generate input image layer
    4.13    ImageLayerGeneratorPointerType lVisuGenerator = ImageLayerGeneratorType::New();
    4.14    FltkFilterWatcher qlwatcher(lVisuGenerator->GetResampler(),0,0,200,20,"Generating QuickLook ...");
    4.15 -  StandardRenderingFunctionPointerType renderer1 = StandardRenderingFunctionType::New();
    4.16 +  StandardRenderingFunction::Pointer renderer1 = StandardRenderingFunction::New();
    4.17    lVisuGenerator->SetImage(m_InputImage);
    4.18    lVisuGenerator->SetRenderingFunction(renderer1);
    4.19    lVisuGenerator->GenerateLayer();
    4.20    lVisuGenerator->GetLayer()->SetName("Input Image");
    4.21    // Save the Input Image Layer
    4.22    m_ImageLayerList->PushBack(lVisuGenerator->GetLayer());
    4.23 -  // Save the input image Rendering Function
    4.24 -  m_RenderingFunctionList->PushBack(renderer1);
    4.25  
    4.26 -
    4.27 -  // Add the layer to the model 
    4.28 +  // Add the layer to the model
    4.29    m_VisuModel->AddLayer(lVisuGenerator->GetLayer());
    4.30    // Render
    4.31    m_VisuModel->Update();
    4.32  
    4.33 - 
    4.34 +
    4.35    /// Generate luminance image layer
    4.36    ImageLayerGeneratorPointerType lLVisuGenerator = ImageLayerGeneratorType::New();
    4.37 -  StandardRenderingFunctionPointerType renderer2 = StandardRenderingFunctionType::New();
    4.38 +  StandardRenderingFunction::Pointer renderer2 = StandardRenderingFunction::New();
    4.39    lLVisuGenerator->SetRenderingFunction(renderer2);
    4.40    lLVisuGenerator->SetImage(m_ImageToLuminanceFilter->GetOutput());
    4.41    lLVisuGenerator->SetGenerateQuicklook(false);
    4.42    lLVisuGenerator->GenerateLayer();
    4.43    lLVisuGenerator->GetLayer()->SetName("Luminance");
    4.44 - 
    4.45 +
    4.46    // Save the Input Image Layer
    4.47    m_ImageLayerList->PushBack(lLVisuGenerator->GetLayer());
    4.48 -  // Save the input image Rendering Function
    4.49 -  m_RenderingFunctionList->PushBack(renderer2);
    4.50    // Add the layer
    4.51    m_RVisuModel->AddLayer(lLVisuGenerator->GetLayer());
    4.52  
    4.53    /// Generate reflectance TOA image layer
    4.54    ImageLayerGeneratorPointerType lRTOAVisuGenerator = ImageLayerGeneratorType::New();
    4.55 -  StandardRenderingFunctionPointerType renderer3 = StandardRenderingFunctionType::New();
    4.56 +  StandardRenderingFunction::Pointer renderer3 = StandardRenderingFunction::New();
    4.57    lRTOAVisuGenerator->SetImage(m_LuminanceToReflectanceFilter->GetOutput());
    4.58    lRTOAVisuGenerator->SetRenderingFunction(renderer3);
    4.59    lRTOAVisuGenerator->SetGenerateQuicklook(false);
    4.60    lRTOAVisuGenerator->GenerateLayer();
    4.61    lRTOAVisuGenerator->GetLayer()->SetName("Reflectance TOA");
    4.62 - 
    4.63 +
    4.64   // Save the Input Image Layer
    4.65    m_ImageLayerList->PushBack(lRTOAVisuGenerator->GetLayer());
    4.66 - // Save the input image Rendering Function
    4.67 -  m_RenderingFunctionList->PushBack(renderer3);
    4.68    // Add the layer
    4.69    m_RVisuModel->AddLayer(lRTOAVisuGenerator->GetLayer());
    4.70  
    4.71 @@ -200,11 +192,11 @@
    4.72    // ImageToLuminance
    4.73    lImageMetadataInterface->GetPhysicalGain(lReader->GetOutput()->GetMetaDataDictionary());
    4.74    lImageMetadataInterface->GetPhysicalBias(lReader->GetOutput()->GetMetaDataDictionary());
    4.75 -  
    4.76 +
    4.77    // LuminanceToReflectance
    4.78    lImageMetadataInterface->GetDay(lReader->GetOutput()->GetMetaDataDictionary());
    4.79    lImageMetadataInterface->GetMonth(lReader->GetOutput()->GetMetaDataDictionary());
    4.80 -  
    4.81 +
    4.82    lImageMetadataInterface->GetSolarIrradiance(lReader->GetOutput()->GetMetaDataDictionary());
    4.83    lImageMetadataInterface->GetSunElevation(lReader->GetOutput()->GetMetaDataDictionary());
    4.84  }
    4.85 @@ -293,22 +285,23 @@
    4.86  RadiometricCalibrationModel
    4.87  ::UpdateRGBChannelOrder(int redChoice , int greenChoice, int blueChoice)
    4.88  {
    4.89 -  m_RenderingFunctionList->GetNthElement(INPUT_IMAGE)->GetPixelRepresentationFunction().SetRedChannelIndex(redChoice);
    4.90 -  m_RenderingFunctionList->GetNthElement(INPUT_IMAGE)->GetPixelRepresentationFunction().SetGreenChannelIndex(greenChoice);
    4.91 -  m_RenderingFunctionList->GetNthElement(INPUT_IMAGE)->GetPixelRepresentationFunction().SetBlueChannelIndex(blueChoice);
    4.92 +  ChannelListType channels;
    4.93 +  channels.push_back(redChoice);
    4.94 +  channels.push_back(greenChoice);
    4.95 +  channels.push_back(blueChoice);
    4.96  
    4.97 -  m_RenderingFunctionList->GetNthElement(LUMINANCE)->GetPixelRepresentationFunction().SetRedChannelIndex(redChoice);
    4.98 -  m_RenderingFunctionList->GetNthElement(LUMINANCE)->GetPixelRepresentationFunction().SetGreenChannelIndex(greenChoice);
    4.99 -  m_RenderingFunctionList->GetNthElement(LUMINANCE)->GetPixelRepresentationFunction().SetBlueChannelIndex(blueChoice);
   4.100 +  StandardRenderingFunction::Pointer inputRendering = StandardRenderingFunction::New();
   4.101 +  inputRendering->SetChannelList(channels);
   4.102 +  m_ImageLayerList->GetNthElement(INPUT_IMAGE)->SetRenderingFunction(inputRendering);
   4.103  
   4.104 -  m_RenderingFunctionList->GetNthElement(REFLECTANCE_TOA)->GetPixelRepresentationFunction().SetRedChannelIndex(redChoice);
   4.105 -  m_RenderingFunctionList->GetNthElement(REFLECTANCE_TOA)->GetPixelRepresentationFunction().SetGreenChannelIndex(greenChoice);
   4.106 -  m_RenderingFunctionList->GetNthElement(REFLECTANCE_TOA)->GetPixelRepresentationFunction().SetBlueChannelIndex(blueChoice);
   4.107 +  StandardRenderingFunction::Pointer luminanceRendering = StandardRenderingFunction::New();
   4.108 +  luminanceRendering->SetChannelList(channels);
   4.109 +  m_ImageLayerList->GetNthElement(LUMINANCE)->SetRenderingFunction(luminanceRendering);
   4.110  
   4.111 -  // Update the layer
   4.112 -  m_ImageLayerList->GetNthElement(INPUT_IMAGE)->SetRenderingFunction(m_RenderingFunctionList->GetNthElement(INPUT_IMAGE));
   4.113 -  m_ImageLayerList->GetNthElement(LUMINANCE)->SetRenderingFunction(m_RenderingFunctionList->GetNthElement(LUMINANCE));
   4.114 -  m_ImageLayerList->GetNthElement(REFLECTANCE_TOA)->SetRenderingFunction(m_RenderingFunctionList->GetNthElement(REFLECTANCE_TOA));
   4.115 +  StandardRenderingFunction::Pointer reflectanceRendering = StandardRenderingFunction::New();
   4.116 +  reflectanceRendering->SetChannelList(channels);
   4.117 +  m_ImageLayerList->GetNthElement(REFLECTANCE_TOA)->SetRenderingFunction(reflectanceRendering);
   4.118 +
   4.119    // Update the view
   4.120    m_VisuModel->Update();
   4.121    // Update the result
   4.122 @@ -320,14 +313,22 @@
   4.123  RadiometricCalibrationModel
   4.124  ::UpdateGrayscaleChannel(int choice)
   4.125  {
   4.126 -  m_RenderingFunctionList->GetNthElement(INPUT_IMAGE)->GetPixelRepresentationFunction().SetAllChannels(choice);
   4.127 -  m_RenderingFunctionList->GetNthElement(LUMINANCE)->GetPixelRepresentationFunction().SetAllChannels(choice);
   4.128 -  m_RenderingFunctionList->GetNthElement(REFLECTANCE_TOA)->GetPixelRepresentationFunction().SetAllChannels(choice);
   4.129 +  ChannelListType channels;
   4.130 +  channels.push_back(choice);
   4.131  
   4.132 -  //Update the layer
   4.133 -  m_ImageLayerList->GetNthElement(INPUT_IMAGE)->SetRenderingFunction(m_RenderingFunctionList->GetNthElement(INPUT_IMAGE));
   4.134 -  m_ImageLayerList->GetNthElement(LUMINANCE)->SetRenderingFunction(m_RenderingFunctionList->GetNthElement(LUMINANCE));
   4.135 -  m_ImageLayerList->GetNthElement(REFLECTANCE_TOA)->SetRenderingFunction(m_RenderingFunctionList->GetNthElement(REFLECTANCE_TOA));
   4.136 +  StandardRenderingFunction::Pointer inputRendering = StandardRenderingFunction::New();
   4.137 +  inputRendering->SetChannelList(channels);
   4.138 +  m_ImageLayerList->GetNthElement(INPUT_IMAGE)->SetRenderingFunction(inputRendering);
   4.139 +
   4.140 +  StandardRenderingFunction::Pointer luminanceRendering = StandardRenderingFunction::New();
   4.141 +  luminanceRendering->SetChannelList(channels);
   4.142 +  m_ImageLayerList->GetNthElement(LUMINANCE)->SetRenderingFunction(luminanceRendering);
   4.143 +
   4.144 +  StandardRenderingFunction::Pointer reflectanceRendering = StandardRenderingFunction::New();
   4.145 +  reflectanceRendering->SetChannelList(channels);
   4.146 +  m_ImageLayerList->GetNthElement(REFLECTANCE_TOA)->SetRenderingFunction(reflectanceRendering);
   4.147 +
   4.148 +
   4.149    // Update the view
   4.150    m_VisuModel->Update();
   4.151    // Update the result
   4.152 @@ -337,25 +338,30 @@
   4.153  
   4.154  void
   4.155  RadiometricCalibrationModel
   4.156 -::UpdateModulusChannelOrder(int realChoice , int imChoice)
   4.157 +::UpdateAmplitudeChannelOrder(int realChoice , int imChoice)
   4.158  {
   4.159 -  // ModulusRenderingFunction::Pointer modulusFunction;
   4.160 -//   modulusFunction = ModulusRenderingFunction::New();
   4.161 -//   modulusFunction->SetRedChannelIndex(realChoice);
   4.162 -//   modulusFunction->SetGreenChannelIndex(imChoice);
   4.163 -//   modulusFunction->Initialize();
   4.164 -//   m_RenderingFunctionList->SetNthElement(INPUT_IMAGE,modulusFunction);
   4.165 -//   m_RenderingFunctionList->SetNthElement(LUMINANCE,modulusFunction);
   4.166 -//   m_RenderingFunctionList->SetNthElement(REFLECTANCE_TOA,modulusFunction);
   4.167  
   4.168 -//   //Update the layer
   4.169 -//   m_ImageLayerList->GetNthElement(INPUT_IMAGE)->SetRenderingFunction(modulusFunction);
   4.170 -//   m_ImageLayerList->GetNthElement(LUMINANCE)->SetRenderingFunction(modulusFunction);
   4.171 -//   m_ImageLayerList->GetNthElement(REFLECTANCE_TOA)->SetRenderingFunction(modulusFunction);
   4.172 -//   // Update the view
   4.173 -//   m_VisuModel->Update();
   4.174 -//   // Update the result
   4.175 -//   m_RVisuModel->Update();
   4.176 +  ChannelListType channels;
   4.177 +  channels.push_back(realChoice);
   4.178 +  channels.push_back(imChoice);
   4.179 +
   4.180 +
   4.181 +  AmplitudeRenderingFunction::Pointer inputRendering = AmplitudeRenderingFunction::New();
   4.182 +  inputRendering->SetChannelList(channels);
   4.183 +  m_ImageLayerList->GetNthElement(INPUT_IMAGE)->SetRenderingFunction(inputRendering);
   4.184 +
   4.185 +  AmplitudeRenderingFunction::Pointer luminanceRendering = AmplitudeRenderingFunction::New();
   4.186 +  luminanceRendering->SetChannelList(channels);
   4.187 +  m_ImageLayerList->GetNthElement(LUMINANCE)->SetRenderingFunction(luminanceRendering);
   4.188 +
   4.189 +  AmplitudeRenderingFunction::Pointer reflectanceRendering = AmplitudeRenderingFunction::New();
   4.190 +  reflectanceRendering->SetChannelList(channels);
   4.191 +  m_ImageLayerList->GetNthElement(REFLECTANCE_TOA)->SetRenderingFunction(reflectanceRendering);
   4.192 +
   4.193 +  // Update the view
   4.194 +  m_VisuModel->Update();
   4.195 +  // Update the result
   4.196 +  m_RVisuModel->Update();
   4.197  
   4.198  }
   4.199  
   4.200 @@ -364,23 +370,26 @@
   4.201  RadiometricCalibrationModel
   4.202  ::UpdatePhaseChannelOrder(int realChoice , int imChoice)
   4.203  {
   4.204 -//   StandardRenderingFunctionType::Pointer phaseFunction;
   4.205 -//   phaseFunction = PhaseRenderingFunction::New();
   4.206 -//   phaseFunction->SetRedChannelIndex(realChoice);
   4.207 -//   phaseFunction->SetGreenChannelIndex(imChoice);
   4.208 -//   phaseFunction->Initialize();
   4.209 -//   m_RenderingFunctionList->SetNthElement(INPUT_IMAGE,phaseFunction);
   4.210 -//   m_RenderingFunctionList->SetNthElement(LUMINANCE,phaseFunction);
   4.211 -//   m_RenderingFunctionList->SetNthElement(REFLECTANCE_TOA,phaseFunction);
   4.212 +  ChannelListType channels;
   4.213 +  channels.push_back(realChoice);
   4.214 +  channels.push_back(imChoice);
   4.215  
   4.216 -//   //Update the layer
   4.217 -//   m_ImageLayerList->GetNthElement(INPUT_IMAGE)->SetRenderingFunction(phaseFunction);
   4.218 -//   m_ImageLayerList->GetNthElement(LUMINANCE)->SetRenderingFunction(phaseFunction);
   4.219 -//   m_ImageLayerList->GetNthElement(REFLECTANCE_TOA)->SetRenderingFunction(phaseFunction);
   4.220 -//   // Update the view
   4.221 -//   m_VisuModel->Update();
   4.222 -//   // Update the result
   4.223 -//   m_RVisuModel->Update();
   4.224 +  PhaseRenderingFunction::Pointer inputRendering = PhaseRenderingFunction::New();
   4.225 +  inputRendering->SetChannelList(channels);
   4.226 +  m_ImageLayerList->GetNthElement(INPUT_IMAGE)->SetRenderingFunction(inputRendering);
   4.227 +
   4.228 +  PhaseRenderingFunction::Pointer luminanceRendering = PhaseRenderingFunction::New();
   4.229 +  luminanceRendering->SetChannelList(channels);
   4.230 +  m_ImageLayerList->GetNthElement(LUMINANCE)->SetRenderingFunction(luminanceRendering);
   4.231 +
   4.232 +  PhaseRenderingFunction::Pointer reflectanceRendering = PhaseRenderingFunction::New();
   4.233 +  reflectanceRendering->SetChannelList(channels);
   4.234 +  m_ImageLayerList->GetNthElement(REFLECTANCE_TOA)->SetRenderingFunction(reflectanceRendering);
   4.235 +
   4.236 +  // Update the view
   4.237 +  m_VisuModel->Update();
   4.238 +  // Update the result
   4.239 +  m_RVisuModel->Update();
   4.240  
   4.241  }
   4.242  
     5.1 --- a/RadiometricCalibration/Model/otbRadiometricCalibrationModel.h	Fri Jun 26 17:29:07 2009 +0800
     5.2 +++ b/RadiometricCalibration/Model/otbRadiometricCalibrationModel.h	Fri Jun 26 17:54:21 2009 +0800
     5.3 @@ -95,14 +95,18 @@
     5.4    typedef ImageLayerGeneratorType::Pointer               ImageLayerGeneratorPointerType;
     5.5  
     5.6    /** Rendering functions */
     5.7 -  typedef Function::StandardRenderingFunction<ImageType::PixelType,RGBPixelType>   StandardRenderingFunctionType;
     5.8 -  typedef StandardRenderingFunctionType::Pointer         StandardRenderingFunctionPointerType;
     5.9 -  typedef ObjectList<StandardRenderingFunctionType>      StandardRenderingFunctionListType;
    5.10 -  typedef StandardRenderingFunctionListType::Pointer     StandardRenderingFunctionListPointerType;
    5.11 +  typedef Function::RenderingFunction<ImageType::PixelType,RGBPixelType>  RenderingFunctionType;
    5.12 +  typedef RenderingFunctionType::Pointer                 RenderingFunctionPointerType;
    5.13 +//   typedef ObjectList<RenderingFunctionType>      RenderingFunctionListType;
    5.14 +//   typedef RenderingFunctionListType::Pointer     RenderingFunctionListPointerType;
    5.15 +
    5.16 +  typedef Function::StandardRenderingFunction<ImageType::PixelType,RGBPixelType>    StandardRenderingFunction;
    5.17 +
    5.18    typedef Function::StandardRenderingFunction<ImageType::PixelType, RGBPixelType,
    5.19 -  otb::Function::AmplitudeFunctor<ImageType::PixelType> >                            ModulusRenderingFunction;
    5.20 +  otb::Function::AmplitudeFunctor<ImageType::PixelType> >                           AmplitudeRenderingFunction;
    5.21    typedef Function::StandardRenderingFunction<ImageType::PixelType, RGBPixelType,
    5.22 -  otb::Function::PhaseFunctor<ImageType::PixelType> >                                PhaseRenderingFunction;
    5.23 +  otb::Function::PhaseFunctor<ImageType::PixelType> >                               PhaseRenderingFunction;
    5.24 +  typedef std::vector<unsigned int>                                                 ChannelListType;
    5.25  
    5.26    /** Visu */
    5.27    typedef otb::ImageLayerRenderingModel<ViewerImageType> VisuModelType;
    5.28 @@ -140,8 +144,8 @@
    5.29    itkGetObjectMacro(ImageLayerList,ImageLayerListType);
    5.30  
    5.31    /** Get/Set the Image Layer */
    5.32 -  itkSetObjectMacro(RenderingFunctionList,StandardRenderingFunctionListType);
    5.33 -  itkGetObjectMacro(RenderingFunctionList,StandardRenderingFunctionListType);
    5.34 +//   itkSetObjectMacro(RenderingFunctionList,RenderingFunctionListType);
    5.35 +//   itkGetObjectMacro(RenderingFunctionList,RenderingFunctionListType);
    5.36  
    5.37    /** Get/Set Pixel Description */
    5.38    itkSetObjectMacro(PixelDescriptionModel,PixelDescriptionModelType);
    5.39 @@ -188,7 +192,7 @@
    5.40    /** Update view channel order */
    5.41    void UpdateRGBChannelOrder(int redChoice , int greenChoice, int BlueChoice);
    5.42    void UpdateGrayscaleChannel(int choice);
    5.43 -  void UpdateModulusChannelOrder(int realChoice , int imChoice);
    5.44 +  void UpdateAmplitudeChannelOrder(int realChoice , int imChoice);
    5.45    void UpdatePhaseChannelOrder(int realChoice , int imChoice);
    5.46    void CheckMetadata(std::string filename);
    5.47  
    5.48 @@ -221,7 +225,7 @@
    5.49    ImageLayerListPointerType   m_ImageLayerList;
    5.50  
    5.51    /** StandardRenderingFunction list */
    5.52 -  StandardRenderingFunctionListPointerType m_RenderingFunctionList;
    5.53 +//   RenderingFunctionListPointerType m_RenderingFunctionList;
    5.54  
    5.55    /** The pixel description model */
    5.56    PixelDescriptionModelPointerType m_PixelDescriptionModel;
     6.1 --- a/RadiometricCalibration/View/otbRadiometricCalibrationViewGUI.cxx	Fri Jun 26 17:29:07 2009 +0800
     6.2 +++ b/RadiometricCalibration/View/otbRadiometricCalibrationViewGUI.cxx	Fri Jun 26 17:54:21 2009 +0800
     6.3 @@ -204,18 +204,20 @@
     6.4  RadiometricCalibrationViewGUI
     6.5  ::RenderCurveWidget(EnumImageType pType)
     6.6  {
     6.7 -  if( m_RadiometricCalibrationModel->GetImageLayerList()->Size() < static_cast<unsigned int>(pType) || 
     6.8 -      m_RadiometricCalibrationModel->GetRenderingFunctionList()->Size() < static_cast<unsigned int>(pType) )
     6.9 +  if( m_RadiometricCalibrationModel->GetImageLayerList()->Size() < static_cast<unsigned int>(pType) )
    6.10      return;
    6.11  
    6.12    ImageLayerPointerType lImageLayer;
    6.13 -  StandardRenderingFunctionPointerType lRenderingFunction;
    6.14 +  lImageLayer = m_RadiometricCalibrationModel->GetImageLayerList()->GetNthElement(pType);
    6.15  
    6.16 -  lImageLayer = m_RadiometricCalibrationModel->GetImageLayerList()->GetNthElement(pType);
    6.17 -  lRenderingFunction = m_RadiometricCalibrationModel->GetRenderingFunctionList()->GetNthElement(pType);
    6.18 +  RenderingFunctionPointerType lRenderingFunction;
    6.19 +  lRenderingFunction = lImageLayer->GetRenderingFunction();
    6.20 +
    6.21 +  ChannelListType channels = lRenderingFunction->GetChannelList();
    6.22 +//   lRenderingFunction = m_RadiometricCalibrationModel->GetRenderingFunctionList()->GetNthElement(pType);
    6.23  
    6.24    // Colors
    6.25 -  HistogramCurveType::ColorType red,green,blue;
    6.26 +  HistogramCurveType::ColorType red,green,blue,grey;
    6.27    red.Fill(0);
    6.28    red[0]=1.;
    6.29    red[3]=0.5;
    6.30 @@ -228,33 +230,48 @@
    6.31    blue[2]=1.;
    6.32    blue[3]=0.5;
    6.33  
    6.34 -  // adding histograms rendering
    6.35 +  grey.Fill(0.5);
    6.36 +
    6.37 +  CurvesWidgetPointerType curveWidget = CurvesWidgetType::New();
    6.38 +  curveWidget->ClearAllCurves();
    6.39 +
    6.40 +  if (lRenderingFunction->GetPixelRepresentationSize() >=3)
    6.41 +  {
    6.42 +   HistogramCurveType::Pointer bhistogram = HistogramCurveType::New();
    6.43 +   bhistogram->SetHistogramColor(blue);
    6.44 +   bhistogram->SetLabelColor(blue);
    6.45 +   bhistogram->SetHistogram(lImageLayer->GetHistogramList()->GetNthElement(channels[2]));
    6.46 +   curveWidget->AddCurve(bhistogram);
    6.47 +  }
    6.48 +
    6.49 +  if (lRenderingFunction->GetPixelRepresentationSize() >=2)
    6.50 +  {
    6.51 +   HistogramCurveType::Pointer ghistogram = HistogramCurveType::New();
    6.52 +   ghistogram->SetHistogramColor(green);
    6.53 +   ghistogram->SetLabelColor(green);
    6.54 +   ghistogram->SetHistogram(lImageLayer->GetHistogramList()->GetNthElement(channels[1]));
    6.55 +   curveWidget->AddCurve(ghistogram);
    6.56 +  }
    6.57 +
    6.58    HistogramCurveType::Pointer rhistogram = HistogramCurveType::New();
    6.59 -  rhistogram->SetHistogram(lImageLayer->GetHistogramList()->GetNthElement(lRenderingFunction->GetPixelRepresentationFunction().GetRedChannelIndex()));
    6.60 -  rhistogram->SetHistogramColor(red);
    6.61 -  rhistogram->SetLabelColor(red);
    6.62 +  if (lRenderingFunction->GetPixelRepresentationSize() == 1)
    6.63 +  {
    6.64 +   rhistogram->SetHistogramColor(grey);
    6.65 +   rhistogram->SetLabelColor(grey);
    6.66 +  }
    6.67 +  else
    6.68 +  {
    6.69 +   rhistogram->SetHistogramColor(red);
    6.70 +   rhistogram->SetLabelColor(red);
    6.71 +  }
    6.72 +  rhistogram->SetHistogram(lImageLayer->GetHistogramList()->GetNthElement(channels[0]));
    6.73 +  curveWidget->AddCurve(rhistogram);
    6.74  
    6.75 -  HistogramCurveType::Pointer ghistogram = HistogramCurveType::New();
    6.76 -  ghistogram->SetHistogram(lImageLayer->GetHistogramList()->GetNthElement(lRenderingFunction->GetPixelRepresentationFunction().GetGreenChannelIndex()));
    6.77 -  ghistogram->SetHistogramColor(green);
    6.78 -  ghistogram->SetLabelColor(green);
    6.79 -
    6.80 -  HistogramCurveType::Pointer bhistogram = HistogramCurveType::New();
    6.81 -  bhistogram->SetHistogram(lImageLayer->GetHistogramList()->GetNthElement(lRenderingFunction->GetPixelRepresentationFunction().GetBlueChannelIndex()));
    6.82 -  bhistogram->SetHistogramColor(blue);
    6.83 -  bhistogram->SetLabelColor(blue);
    6.84 -
    6.85 -  // Build the curve widget
    6.86 -  CurvesWidgetPointerType lCurveWidget = CurvesWidgetType::New();
    6.87 -  lCurveWidget->ClearAllCurves();
    6.88 -  lCurveWidget->AddCurve(rhistogram);
    6.89 -  lCurveWidget->AddCurve(ghistogram);
    6.90 -  lCurveWidget->AddCurve(bhistogram);
    6.91 -  lCurveWidget->SetXAxisLabel("Pixels");
    6.92 -  lCurveWidget->SetYAxisLabel("Frequency");
    6.93 -  lCurveWidget->redraw();
    6.94 +  curveWidget->SetXAxisLabel("Pixels");
    6.95 +  curveWidget->SetYAxisLabel("Frequency");
    6.96 +  curveWidget->redraw();
    6.97    // Save the curve widget
    6.98 -  m_CurvesWidgetList->PushBack(lCurveWidget);
    6.99 +  m_CurvesWidgetList->PushBack(curveWidget);
   6.100  
   6.101  
   6.102  }
   6.103 @@ -334,9 +351,9 @@
   6.104       }
   6.105     else if (guiViewerSetupComplexMode->value())
   6.106       {
   6.107 -       if (bModulus->value())
   6.108 +       if (bAmplitude->value())
   6.109       {
   6.110 -       m_RadiometricCalibrationController->UpdateModulusChannelOrder(atoi(guiRealChannelChoice->value())-1,
   6.111 +       m_RadiometricCalibrationController->UpdateAmplitudeChannelOrder(atoi(guiRealChannelChoice->value())-1,
   6.112                                      atoi(guiImaginaryChannelChoice->value())-1);
   6.113       }
   6.114         else
   6.115 @@ -365,7 +382,7 @@
   6.116  void
   6.117  RadiometricCalibrationViewGUI
   6.118  ::GrayscaleSetCallback()
   6.119 -{ 
   6.120 +{
   6.121     guiViewerSetupGrayscaleMode->set();
   6.122     guiViewerSetupColorMode->clear();
   6.123  
   6.124 @@ -383,8 +400,8 @@
   6.125  //    }
   6.126  
   6.127     unsigned int lNbComponent = m_RadiometricCalibrationModel->GetInputImage()->GetNumberOfComponentsPerPixel();
   6.128 -   StandardRenderingFunctionPointerType lRenderingFunction = m_RadiometricCalibrationModel->GetRenderingFunctionList()->GetNthElement(INPUT_IMAGE);
   6.129 -   guiGrayscaleChannelChoice->value(std::min(lRenderingFunction->GetPixelRepresentationFunction().GetRedChannelIndex(),lNbComponent-1));
   6.130 +   RenderingFunctionPointerType lRenderingFunction = m_RadiometricCalibrationModel->GetImageLayerList()->GetNthElement(INPUT_IMAGE)->GetRenderingFunction();
   6.131 +   guiGrayscaleChannelChoice->value(std::min(lRenderingFunction->GetChannelList()[0],lNbComponent-1));
   6.132  
   6.133  }
   6.134  
   6.135 @@ -402,7 +419,7 @@
   6.136     guiGrayscaleChannelChoice->deactivate();
   6.137     guiRealChannelChoice->deactivate();
   6.138     guiImaginaryChannelChoice->deactivate();
   6.139 -   bModulus->deactivate();
   6.140 +   bAmplitude->deactivate();
   6.141     bPhase->deactivate();
   6.142  
   6.143  //    if (m_UrbanAreaExtractionModel->GetState() == NO_IMAGE)
   6.144 @@ -416,12 +433,20 @@
   6.145     guiBlueChannelChoice->activate();
   6.146  
   6.147  
   6.148 -   unsigned int lNbComponent = m_RadiometricCalibrationModel->GetInputImage()->GetNumberOfComponentsPerPixel();
   6.149 +   unsigned int nbComponent = m_RadiometricCalibrationModel->GetInputImage()->GetNumberOfComponentsPerPixel();
   6.150  
   6.151 -   StandardRenderingFunctionPointerType renderingFunction = m_RadiometricCalibrationModel->GetRenderingFunctionList()->GetNthElement(INPUT_IMAGE);
   6.152 -   guiRedChannelChoice->value(std::min(renderingFunction->GetPixelRepresentationFunction().GetRedChannelIndex(),lNbComponent-1));
   6.153 -   guiGreenChannelChoice->value(std::min(renderingFunction->GetPixelRepresentationFunction().GetGreenChannelIndex(),lNbComponent-1));
   6.154 -   guiBlueChannelChoice->value(std::min(renderingFunction->GetPixelRepresentationFunction().GetBlueChannelIndex(),lNbComponent-1));
   6.155 +   RenderingFunctionPointerType renderingFunction = m_RadiometricCalibrationModel->GetImageLayerList()->GetNthElement(INPUT_IMAGE)->GetRenderingFunction();
   6.156 +   ChannelListType channels = renderingFunction->GetChannelList();
   6.157 +   unsigned int i=0;
   6.158 +   while (channels.size() < 3)
   6.159 +   {
   6.160 +     channels.push_back(i);
   6.161 +     ++i;
   6.162 +   }
   6.163 +
   6.164 +   guiRedChannelChoice->value(std::min(channels[0],nbComponent-1));
   6.165 +   guiGreenChannelChoice->value(std::min(channels[1],nbComponent-1));
   6.166 +   guiBlueChannelChoice->value(std::min(channels[2],nbComponent-1));
   6.167  
   6.168  }
   6.169  
   6.170 @@ -432,10 +457,6 @@
   6.171  RadiometricCalibrationViewGUI
   6.172  ::ComplexSetCallback()
   6.173  {
   6.174 -
   6.175 -   StandardRenderingFunctionPointerType renderingFunction = m_RadiometricCalibrationModel->GetRenderingFunctionList()->GetNthElement(INPUT_IMAGE);
   6.176 -   unsigned int lNbComponent = m_RadiometricCalibrationModel->GetInputImage()->GetNumberOfComponentsPerPixel();
   6.177 -
   6.178     guiViewerSetupComplexMode->set();
   6.179     guiViewerSetupColorMode->clear();
   6.180     guiViewerSetupGrayscaleMode->clear();
   6.181 @@ -445,11 +466,23 @@
   6.182     guiBlueChannelChoice->deactivate();
   6.183     guiRealChannelChoice->activate();
   6.184     guiImaginaryChannelChoice->activate();
   6.185 -   bModulus->activate();
   6.186 +   bAmplitude->activate();
   6.187     bPhase->activate();
   6.188  
   6.189 -   guiRealChannelChoice->value(std::min(renderingFunction->GetPixelRepresentationFunction().GetRedChannelIndex(),lNbComponent-1));
   6.190 -   guiImaginaryChannelChoice->value(std::min(renderingFunction->GetPixelRepresentationFunction().GetGreenChannelIndex(),lNbComponent-1));
   6.191 +   RenderingFunctionPointerType renderingFunction = m_RadiometricCalibrationModel->GetImageLayerList()->GetNthElement(INPUT_IMAGE)->GetRenderingFunction();
   6.192 +   unsigned int nbComponent = m_RadiometricCalibrationModel->GetInputImage()->GetNumberOfComponentsPerPixel();
   6.193 +
   6.194 +
   6.195 +   ChannelListType channels = renderingFunction->GetChannelList();
   6.196 +   unsigned int i=0;
   6.197 +   while (channels.size() < 2)
   6.198 +   {
   6.199 +     channels.push_back(i);
   6.200 +     ++i;
   6.201 +   }
   6.202 +
   6.203 +   guiRealChannelChoice->value(std::min(channels[0],nbComponent-1));
   6.204 +   guiImaginaryChannelChoice->value(std::min(channels[1],nbComponent-1));
   6.205  }
   6.206  
   6.207   /**
   6.208 @@ -557,7 +590,7 @@
   6.209    m_VisuView->GetFullWidget()->show();
   6.210    m_VisuView->GetZoomWidget()->show();
   6.211    m_PixelDescriptionGroup->show();
   6.212 -  
   6.213 +
   6.214    m_RFullGroup->hide();
   6.215    m_RZoomGroup->hide();
   6.216    m_RVisuView->GetFullWidget()->hide();
   6.217 @@ -574,7 +607,7 @@
   6.218    m_RVisuView->GetFullWidget()->show();
   6.219    m_RVisuView->GetZoomWidget()->show();
   6.220    m_RPixelDescriptionGroup->show();
   6.221 -  
   6.222 +
   6.223    m_FullGroup->hide();
   6.224    m_ZoomGroup->hide();
   6.225    m_VisuView->GetFullWidget()->hide();
     7.1 --- a/RadiometricCalibration/View/otbRadiometricCalibrationViewGUI.h	Fri Jun 26 17:29:07 2009 +0800
     7.2 +++ b/RadiometricCalibration/View/otbRadiometricCalibrationViewGUI.h	Fri Jun 26 17:54:21 2009 +0800
     7.3 @@ -85,8 +85,9 @@
     7.4      < PixelDescriptionModelType >                            PixelDescriptionViewType;
     7.5    typedef PixelDescriptionViewType::Pointer                  PixelDescriptionViewPointerType;
     7.6  
     7.7 -  typedef RadiometricCalibrationModelType::StandardRenderingFunctionPointerType 
     7.8 -                                                             StandardRenderingFunctionPointerType;
     7.9 +  typedef RadiometricCalibrationModelType::RenderingFunctionType::Pointer
    7.10 +                                                             RenderingFunctionPointerType;
    7.11 +  typedef std::vector<unsigned int>                          ChannelListType;
    7.12  
    7.13    /** Histogram from Image layer type */
    7.14    typedef RadiometricCalibrationModelType::HistogramType     HistogramType;
     8.1 --- a/RadiometricCalibration/View/otbRadiometricCalibrationViewGroup.fl	Fri Jun 26 17:29:07 2009 +0800
     8.2 +++ b/RadiometricCalibration/View/otbRadiometricCalibrationViewGroup.fl	Fri Jun 26 17:54:21 2009 +0800
     8.3 @@ -198,14 +198,14 @@
     8.4          label {Imaginary channel index } open
     8.5          tooltip {Select band for imaginary channel in complex composition} xywh {375 96 57 24} box EMBOSSED_BOX color 7 selection_color 55 labelcolor 187 deactivate
     8.6        } {}
     8.7 -      Fl_Round_Button bModulus {
     8.8 -        label Modulus
     8.9 +      Fl_Round_Button bAmplitude {
    8.10 +        label Amplitude
    8.11          callback {bPhase->clear();}
    8.12          tooltip {Toggle modulus mode} xywh {235 50 80 15} down_box ROUND_DOWN_BOX value 1 labelcolor 187 deactivate
    8.13        }
    8.14        Fl_Round_Button bPhase {
    8.15          label Phase
    8.16 -        callback {bModulus->clear();}
    8.17 +        callback {bAmplitude->clear();}
    8.18          tooltip {Toggle phase mode} xywh {325 50 80 15} down_box ROUND_DOWN_BOX labelcolor 187 deactivate
    8.19        }
    8.20      }