Skip to content
Snippets Groups Projects
Commit 8547990c authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

ENH : progress in ImageViewerManager

parent 0c477ae4
Branches
Tags
No related merge requests found
......@@ -32,15 +32,9 @@ ImageViewerManagerModel::Pointer ImageViewerManagerModel::Instance = NULL;
ImageViewerManagerModel::ImageViewerManagerModel()
{
/* Generate image layers*/
m_VisuGenerator = LayerGeneratorType::New();
m_PixelModel = PixelDescriptionModelType::New();
//Set all the boolean to false
m_HasChangedChannelOrder = false;
m_HasImageOpened = false;
}
ImageViewerManagerModel
......@@ -76,35 +70,46 @@ ImageViewerManagerModel
reader->GenerateOutputInformation();
/** Generate the layer*/
m_VisuGenerator->SetImage(reader->GetOutput());
m_VisuGenerator->GenerateLayer();
StandardRenderingFunctionType::Pointer rendrerFuntion = m_VisuGenerator->GetDefaultRenderingFunction();
LayerGeneratorPointerType visuGenerator = LayerGeneratorType::New();
visuGenerator->SetImage(reader->GetOutput());
visuGenerator->GenerateLayer();
StandardRenderingFunctionType::Pointer rendrerFuntion = visuGenerator->GetDefaultRenderingFunction();
/** Rendering image*/
VisuModelPointerType rendering = VisuModelType::New();
rendering->AddLayer(m_VisuGenerator->GetLayer());
rendering->AddLayer(visuGenerator->GetLayer());
rendering->Update();
/** View*/
VisuViewPointerType visuView = this->BuiltVisu(rendering);
/** Build the pixelDescription View*/
PixelDescriptionViewType::Pointer pixelView = PixelDescriptionViewType::New();
PixelDescriptionModelPointerType pixelModel = PixelDescriptionModelType::New();
pixelModel->SetLayers(rendering->GetLayers());
pixelView->SetModel(pixelModel);
/** Controller*/
WidgetControllerPointerType controller = this->BuiltController(rendering, visuView);
WidgetControllerPointerType controller = this->BuiltController(rendering, visuView ,pixelModel );
/** Finish Cuilting the visu*/
/** Finish Builting the visu*/
visuView->SetController(controller);
/** Build the curve Widget */
CurvesWidgetType::Pointer curveWidget = CurvesWidgetType::New();
/** Store all the information in the structure*/
ObjectsTracked currentComponent;
currentComponent.fileName = filename;
currentComponent.pLayer = m_VisuGenerator->GetLayer();
currentComponent.pLayer = visuGenerator->GetLayer();
currentComponent.pReader = reader;
currentComponent.pRendering = rendering;
currentComponent.pVisuView = visuView;
currentComponent.pWidgetController = controller;
currentComponent.pRenderFuntion = rendrerFuntion;
currentComponent.pPixelView = pixelView;
currentComponent.pCurveWidget = curveWidget;
/** Add the the struct in the list*/
m_ObjectTrackedList.push_back(currentComponent);
......@@ -135,7 +140,7 @@ ImageViewerManagerModel
ImageViewerManagerModel
::WidgetControllerPointerType
ImageViewerManagerModel
::BuiltController(VisuModelPointerType modelRenderingLayer, VisuViewPointerType visuView)
::BuiltController(VisuModelPointerType modelRenderingLayer, VisuViewPointerType visuView, PixelDescriptionModelPointerType pixelModel)
{
WidgetControllerPointerType controller = WidgetControllerType::New();
......@@ -164,13 +169,11 @@ ImageViewerManagerModel
controller->AddActionHandler(changeScaleHandler);
//Pixel Description Handling
m_PixelModel->SetLayers(modelRenderingLayer->GetLayers());
PixelDescriptionActionHandlerType::Pointer pixelActionHandler = PixelDescriptionActionHandlerType::New();
pixelActionHandler->SetView(visuView);
pixelActionHandler->SetModel(m_PixelModel);
pixelActionHandler->SetModel(pixelModel);
controller->AddActionHandler(pixelActionHandler);
return controller;
}
......
......@@ -39,8 +39,11 @@ PURPOSE. See the above copyright notices for more information.
#include "otbModulusRenderingFunction.h"
#include "otbPhaseRenderingFunction.h"
#include "otbPixelDescriptionModel.h"
#include "otbPixelDescriptionView.h"
#include "otbPixelDescriptionActionHandler.h"
#include "otbCurves2DWidget.h"
#include "otbImageView.h"
......@@ -72,25 +75,25 @@ public:
typedef double PixelType;
/** Image Type*/
typedef VectorImage<PixelType , 2> ImageType;
typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef Image<RGBPixelType,2> ViewerImageType;
typedef ImageType::Pointer ImagePointerType;
typedef VectorImage<PixelType , 2> ImageType;
typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef Image<RGBPixelType,2> ViewerImageType;
typedef ImageType::Pointer ImagePointerType;
/** typedef support for layers */
typedef otb::ImageLayer<ImageType> LayerType;
typedef LayerType::Pointer LayerPointerType;
typedef otb::ImageLayer<ImageType> LayerType;
typedef LayerType::Pointer LayerPointerType;
typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType;
typedef LayerGeneratorType::Pointer LayerGeneratorPointerType;
typedef LayerGeneratorType::RenderingFunctionType StandardRenderingFunctionType;
typedef otb::ImageLayerGenerator<LayerType> LayerGeneratorType;
typedef LayerGeneratorType::Pointer LayerGeneratorPointerType;
typedef LayerGeneratorType::RenderingFunctionType StandardRenderingFunctionType;
typedef Function::ModulusRenderingFunction<ImageType::InternalPixelType, RGBPixelType> ModulusRenderingFunction;
typedef Function::PhaseRenderingFunction<ImageType::InternalPixelType, RGBPixelType> PhaseRenderingFunction;
/** typedef support for reader*/
typedef ImageFileReader<ImageType> ReaderType;
typedef ReaderType::Pointer ReaderPointerType;
typedef ImageFileReader<ImageType> ReaderType;
typedef ReaderType::Pointer ReaderPointerType;
/** Typedef support for rendering image*/
typedef otb::ImageLayerRenderingModel<ViewerImageType> VisuModelType;
......@@ -108,10 +111,13 @@ public:
typedef otb::ChangeScaledExtractRegionActionHandler<VisuModelType,VisuViewType> ChangeScaledRegionHandlerType;
typedef otb::ChangeExtractRegionActionHandler<VisuModelType,VisuViewType> ChangeRegionHandlerType;
typedef otb::ChangeScaleActionHandler<VisuModelType,VisuViewType> ChangeScaleHandlerType;
typedef otb::PixelDescriptionModel<ViewerImageType> PixelDescriptionModelType;
typedef otb::PixelDescriptionActionHandler<PixelDescriptionModelType,VisuViewType> PixelDescriptionActionHandlerType;
typedef PixelDescriptionModelType::Pointer PixelDescriptionModelPointerType;
typedef PixelDescriptionView<PixelDescriptionModelType> PixelDescriptionViewType;
typedef otb::PixelDescriptionActionHandler<PixelDescriptionModelType,VisuViewType> PixelDescriptionActionHandlerType;
typedef Curves2DWidget CurvesWidgetType;
/**
* Struct embedded in the model
......@@ -124,8 +130,9 @@ public:
WidgetControllerPointerType pWidgetController;
VisuViewPointerType pVisuView;
StandardRenderingFunctionType::Pointer pRenderFuntion;
PixelDescriptionViewType::Pointer pPixelView;
CurvesWidgetType::Pointer pCurveWidget;
std::string fileName;
};
typedef struct _ObjectsTracked ObjectsTracked;
......@@ -151,10 +158,7 @@ public:
{
return m_ObjectTrackedList;
}
/** Get the pixel description model */
itkGetObjectMacro(PixelModel,PixelDescriptionModelType);
/** Boolean Flags */
itkGetMacro(HasImageOpened,bool);
itkGetMacro(HasChangedChannelOrder,bool);
......@@ -172,7 +176,7 @@ protected:
/** Built Visu & Controller*/
virtual VisuViewPointerType BuiltVisu(VisuModelPointerType pRendering);
virtual WidgetControllerPointerType BuiltController(VisuModelPointerType modelRenderingLayer, VisuViewPointerType visuView);
virtual WidgetControllerPointerType BuiltController(VisuModelPointerType modelRenderingLayer, VisuViewPointerType visuView , PixelDescriptionModelType::Pointer pixelModel);
private:
......@@ -184,18 +188,11 @@ private:
/** The instance singleton */
static Pointer Instance;
/**Temporary Flags*/
PixelDescriptionModelType::Pointer m_PixelModel;
/** Boolean flags*/
bool m_HasImageOpened;
bool m_HasChangedChannelOrder;
/* Layer Generator Smart Pointer*/
LayerGeneratorPointerType m_VisuGenerator;
/** The manipuleted list*/
ObjectTrackedList m_ObjectTrackedList;
};
......
This diff is collapsed.
......@@ -42,6 +42,7 @@ PURPOSE. See the above copyright notices for more information.
#include "otbCurves2DWidget.h"
#include "otbHistogramCurve.h"
#include "otbWidgetManager.h"
#include "otbPackedWidgetManager.h"
#include "otbSplittedWidgetManager.h"
......@@ -84,8 +85,6 @@ public:
typedef ImageView<VisuModelType> VisuViewType;
typedef VisuViewType::Pointer VisuViewPointerType;
/* Method to display the Widget : Packed or Splitted */
typedef PackedWidgetManager PackedWidgetManagerType;
typedef PackedWidgetManagerType::Pointer PackedWidgetManagerPointerType;
......@@ -107,11 +106,13 @@ public:
typedef PixelDescriptionView<PixelDescriptionModelType> PixelDescriptionViewType;
/** vector to store the status of images : diplayed or not displayed*/
typedef std::vector<bool> BoolVector;
//---> Note : f the packed view is selected : 2nd boolean : false, Splitted view : 2nd boolean true;
typedef std::pair<bool, bool> PairType;
typedef std::vector<PairType> BoolVector;
/** list in order to store the diplay manager*/
typedef ObjectList<PackedWidgetManagerType> PackedManagerList;
typedef ObjectList<SplittedWidgetManagerType> SplittedManagerList;
typedef WidgetManager WidgetManagerType;
typedef ObjectList<WidgetManagerType> WidgetManagerList;
......@@ -144,11 +145,11 @@ protected:
virtual void ViewerSetup();
virtual void ViewerSetupOk();
virtual void ViewerSetupCancel();
/* virtual void LinkSetup(); */
/* virtual void LinkSetupRemove(); */
/* virtual void LinkSetupClear(); */
/* virtual void LinkSetupOk(); */
/* virtual void LinkSetupSave(); */
/* virtual void LinkSetup(); */
/* virtual void LinkSetupRemove(); */
/* virtual void LinkSetupClear(); */
/* virtual void LinkSetupOk(); */
/* virtual void LinkSetupSave(); */
virtual void AddImageListName();
virtual void Quit();
virtual void SelectAction();
......@@ -161,20 +162,23 @@ protected:
virtual void GrayScaleSet();
virtual void RGBSet();
virtual void ComplexSet();
/* virtual void Diaporama(); */
/* virtual void DiaporamaPrevious(); */
/* virtual void DiaporamaNext(); */
/* virtual void DiaporamaQuit(); */
virtual void Diaporama();
virtual void DisplayDiaporama();
virtual void DiaporamaNext();
virtual void DiaporamaPrevious();
virtual void DiaporamaQuit();
virtual void UpdateInformation(unsigned int selectedItem);
virtual void UpdateViewerSetupWindow(unsigned int selectedItem);
virtual void DisplayPreviewWidget(unsigned int selectedItem);
virtual void SplittedViewMode();
virtual void PackedViewMode();
virtual void UpdateDiaporamaProgressBar();
/* virtual void UpdateLinkSetupWindow(unsigned int selectedItem); */
/* virtual void UpdatePreviewWindow(unsigned int selectedItem); */
/* virtual void UpdateDiaporamaProgressBar(); */
/** Constructor */
ImageViewerManagerViewGUI();
/** Destructor */
......@@ -194,32 +198,21 @@ private:
//
BoolVector m_DisplayStatusList;
std::string m_TemplateViewerName ;
std::string m_TemplateViewerName;
std::string m_DisplayedLabel;
std::string m_UndisplayedLabel ;
//VisuViewShowedList::Pointer m_VisuViewShowedList;
//Widget Manager
PackedWidgetManagerType::Pointer m_PackedWindow;
SplittedWidgetManagerType::Pointer m_SplittedWindow;
SplittedManagerList::Pointer m_SplittedManagerList;
PackedManagerList::Pointer m_PackedManagerList;
/** Curve widget */
CurvesWidgetPointerType m_CurveWidget;
HistogramCurveType::Pointer m_Bhistogram;
HistogramCurveType::Pointer m_Ghistogram;
HistogramCurveType::Pointer m_Rhistogram;
WidgetManagerList::Pointer m_WidgetManagerList;
//SlideShow widget Manager
PackedWidgetManagerType::Pointer m_WidgetManager;
/** NewVisu */
VisuViewPointerType m_VisuView;
/**ImageWidget for my preview*/
ImageWidgetPointerType m_PreviewWidget;
/** view associated to the pixelDescription*/
PixelDescriptionViewType::Pointer m_PixelView ;
/** Histogram */
StandardRenderingFunctionType::Pointer m_pRenderingFuntion;
......@@ -228,7 +221,7 @@ private:
HistogramCurveType::ColorType m_Blue;
/** Store the component number of a pixel*/
unsigned int m_NbComponent;
unsigned int m_DiaporamaCurrentIndex;
};
}// End namespace otb
......
......@@ -7,8 +7,8 @@ class ImageViewerManagerViewGroup {open
Function {CreateGUI()} {open return_type void
} {
Fl_Window guiMainWindow {
label otbImageViewerManagerView open selected
xywh {495 250 610 460} type Double box UP_BOX color 52 selection_color 7 labelcolor 187 resizable visible
label otbImageViewerManagerView open
xywh {833 76 610 460} type Double box UP_BOX color 52 selection_color 7 labelcolor 187 hide resizable
} {
Fl_Text_Display guiViewerInformation {
label Information
......@@ -23,7 +23,7 @@ class ImageViewerManagerViewGroup {open
xywh {280 38 195 189} resizable
} {}
Fl_Group gBottom {open
xywh {260 244 225 60}
xywh {260 231 225 73}
} {
Fl_Button guiShowHide {
label {Show / Hide}
......@@ -38,6 +38,26 @@ class ImageViewerManagerViewGroup {open
Fl_Group gBlanck1 {open
xywh {475 254 10 41} resizable
} {}
Fl_Round_Button bPacked {
label {Packed View}
callback {PackedViewMode();
//bPacked->value(1);
//if(bSplitted->value())
// bPacked->deactivate();
//else
// bPacked->value(1);}
tooltip {Toggle Packed mode} xywh {380 238 105 15} type Radio down_box ROUND_DOWN_BOX value 1 labelcolor 187 deactivate
}
Fl_Round_Button bSplitted {
label {Splitted View}
callback {SplittedViewMode();
//bSplitted->value(1);
//if(bPacked->value())
// bSplitted->deactivate();
//else
// bSplitted->value(1);} selected
tooltip {Toggle Splitted mode} xywh {275 237 105 15} type Radio down_box ROUND_DOWN_BOX labelcolor 187 deactivate
}
}
Fl_Group gRight {open
xywh {480 31 115 277}
......@@ -78,8 +98,8 @@ class ImageViewerManagerViewGroup {open
}
}
Fl_Window guiViewerSetupWindow {
label {Viewer setup} open
xywh {885 215 705 230} type Double box UP_BOX color 52 selection_color 7 labelcolor 187 visible
label {Viewer setup}
xywh {885 215 705 230} type Double box UP_BOX color 52 selection_color 7 labelcolor 187 hide
} {
Fl_Round_Button guiViewerSetupGrayscaleMode {
label {Grayscale mode}
......@@ -147,7 +167,7 @@ class ImageViewerManagerViewGroup {open
}
Fl_Window guiLinkSetupWindow {
label {Link setup}
xywh {888 755 440 220} type Double box UP_BOX color 52 selection_color 7 labelcolor 187 visible
xywh {888 755 440 220} type Double box UP_BOX color 52 selection_color 7 labelcolor 187 hide
} {
Fl_Input_Choice guiLinkChoice {
label {Link to viewer: } open
......@@ -189,7 +209,7 @@ class ImageViewerManagerViewGroup {open
}
Fl_Window guiDiaporama {
label Slideshow
xywh {1142 721 390 90} type Double box UP_BOX color 52 selection_color 7 labelcolor 187 visible
xywh {652 599 390 90} type Double box UP_BOX color 52 selection_color 7 labelcolor 187 visible
} {
Fl_Progress guiDiaporamaProgressBar {
label Progress
......@@ -259,4 +279,8 @@ class ImageViewerManagerViewGroup {open
} {}
Function {ComplexSet()} {open return_type {virtual void}
} {}
Function {SplittedViewMode()} {open return_type {virtual void}
} {}
Function {PackedViewMode()} {open return_type {virtual void}
} {}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment