Skip to content
Snippets Groups Projects
Commit 330888a0 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: otbStandardImageViewer moving the pixel information bar to the bottom

parent 492658fe
No related branches found
No related tags found
No related merge requests found
......@@ -47,10 +47,10 @@ namespace otb
/** \class StandardImageViewer
* \brief This class implements a standard visualization tool to be
* plugged at the end of a pipeline.
*
*
*/
template <class TImage, class TVectorData = VectorData<double> >
template <class TImage, class TVectorData = VectorData<double> >
class StandardImageViewer
: public itk::Object
{
......@@ -60,10 +60,10 @@ public:
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory */
itkNewMacro(Self);
/** Runtime information */
itkTypeMacro(StandardImageViewer,Object);
......@@ -79,12 +79,12 @@ public:
/** Output image type */
typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef Image<RGBPixelType,2> OutputImageType;
/** Image layer type */
typedef ImageLayer<ImageType> ImageLayerType;
typedef typename ImageLayerType::Pointer ImageLayerPointerType;
typedef typename ImageLayerType::HistogramType HistogramType;
/** Image layer generator type */
typedef ImageLayerGenerator<ImageLayerType> ImageLayerGeneratorType;
typedef typename ImageLayerGeneratorType::Pointer ImageLayerGeneratorPointerType;
......@@ -92,7 +92,7 @@ public:
/** Rendering model type */
typedef ImageLayerRenderingModel<OutputImageType> RenderingModelType;
typedef typename RenderingModelType::Pointer RenderingModelPointerType;
/** View type */
typedef ImageView<RenderingModelType> ViewType;
typedef typename ViewType::Pointer ViewPointerType;
......@@ -100,7 +100,7 @@ public:
/** Widget controller */
typedef ImageWidgetController WidgetControllerType;
typedef typename WidgetControllerType::Pointer WidgetControllerPointerType;
/** Curves 2D widget */
typedef Curves2DWidget CurvesWidgetType;
typedef typename CurvesWidgetType::Pointer CurvesWidgetPointerType;
......@@ -163,7 +163,7 @@ protected:
~StandardImageViewer();
/** Printself method */
void PrintSelf(std::ostream& os, itk::Indent indent) const {};
private:
StandardImageViewer(const Self&); // purposely not implemented
void operator=(const Self&); // purposely not implemented
......@@ -173,7 +173,7 @@ private:
/** Pointer to the image */
ImagePointerType m_Image;
/** Pointer to the VectorData */
VectorDataPointerType m_VectorData;
......@@ -185,7 +185,7 @@ private:
/** The pixel description model */
PixelDescriptionModelPointerType m_PixelDescriptionModel;
/** The view */
ViewPointerType m_View;
......@@ -215,12 +215,14 @@ private:
/** Intial sizes */
int m_Width;
int m_Height;
int m_SideBarWidth;
}; // end class
int m_BottomBarHeight;
}; // end class
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
......
......@@ -23,11 +23,15 @@
namespace otb
{
template <class TImage,class TVectorData>
template <class TImage,class TVectorData>
StandardImageViewer<TImage,TVectorData>
::StandardImageViewer() : m_Label("Default label"), m_Image(), m_VectorData(), m_ImageLayer(), m_RenderingModel(),m_PixelDescriptionModel(),
m_View(), m_PixelDescriptionView(), m_CurveWidget(), m_Controller(), m_RenderingFunction(), m_Window(),
m_FullGroup(),m_SideGroup(),m_Tile(),m_Width(800),m_Height(600), m_SideBarWidth(200)
::StandardImageViewer() : m_Label("Default label"), m_Image(), m_VectorData(),
m_ImageLayer(), m_RenderingModel(),m_PixelDescriptionModel(),
m_View(), m_PixelDescriptionView(), m_CurveWidget(),
m_Controller(), m_RenderingFunction(), m_Window(),
m_FullGroup(), m_SideGroup(), m_Tile(),
m_Width(800), m_Height(600),
m_SideBarWidth(200), m_BottomBarHeight(50)
{
// Build a new rendering model
m_RenderingModel = RenderingModelType::New();
......@@ -43,7 +47,7 @@ StandardImageViewer<TImage,TVectorData>
// Build the curve widget
m_CurveWidget = CurvesWidgetType::New();
// Wire the MBC
m_View->SetModel(m_RenderingModel);
m_View->SetController(m_Controller);
......@@ -85,7 +89,7 @@ StandardImageViewer<TImage,TVectorData>
m_Tile = new Fl_Tile(0,0,m_Width,m_Height);
m_Window->add(m_Tile);
m_Window->resizable(m_Tile);
m_Tile->add(m_View->GetFullWidget());
// m_Tile->resizable(m_View->GetFullWidget());
......@@ -94,14 +98,14 @@ StandardImageViewer<TImage,TVectorData>
m_Tile->add(m_CurveWidget);
m_Tile->add(m_PixelDescriptionView->GetPixelDescriptionWidget());
m_View->GetZoomWidget()->resize(m_Width-m_SideBarWidth,m_Height/4,m_SideBarWidth,m_Height/4);
m_View->GetFullWidget()->resize(0,0,m_Width-m_SideBarWidth,m_Height);
m_View->GetScrollWidget()->resize(m_Width-m_SideBarWidth,0,m_SideBarWidth,m_Height/4);
m_CurveWidget->resize(m_Width-m_SideBarWidth,m_Height/2,m_SideBarWidth,m_Height/4);
m_PixelDescriptionView->GetPixelDescriptionWidget()->resize(m_Width-m_SideBarWidth,3*m_Height/4,m_SideBarWidth,m_Height/4);
m_View->GetZoomWidget()->resize(m_Width-m_SideBarWidth,(m_Height-m_BottomBarHeight)/3,m_SideBarWidth,(m_Height-m_BottomBarHeight)/3);
m_View->GetFullWidget()->resize(0,0,m_Width-m_SideBarWidth,m_Height-m_BottomBarHeight);
m_View->GetScrollWidget()->resize(m_Width-m_SideBarWidth,0,m_SideBarWidth,(m_Height-m_BottomBarHeight)/3);
m_CurveWidget->resize(m_Width-m_SideBarWidth,(m_Height-m_BottomBarHeight)*2/3,m_SideBarWidth,(m_Height-m_BottomBarHeight)/3);
m_PixelDescriptionView->GetPixelDescriptionWidget()->resize(0,m_Height-m_BottomBarHeight,m_Width,m_BottomBarHeight);
}
template <class TImage,class TVectorData>
template <class TImage,class TVectorData>
StandardImageViewer<TImage,TVectorData>
::~StandardImageViewer()
{
......@@ -113,7 +117,7 @@ StandardImageViewer<TImage,TVectorData>
delete m_Window;
}
template <class TImage,class TVectorData>
template <class TImage,class TVectorData>
void
StandardImageViewer<TImage,TVectorData>
::Update()
......@@ -126,7 +130,7 @@ StandardImageViewer<TImage,TVectorData>
// Update image info for further use
m_Image->UpdateOutputInformation();
// If there is a VectorData
if(m_VectorData.IsNotNull())
{
......@@ -138,7 +142,7 @@ StandardImageViewer<TImage,TVectorData>
vproj->SetOutputSpacing(m_Image->GetSpacing());
vproj->SetDEMDirectory(m_DEMDirectory);
vproj->Update();
// Create a VectorData gl component
typename VectorDataGlComponentType::Pointer vgl = VectorDataGlComponentType::New();
vgl->SetVectorData(vproj->GetOutput());
......@@ -169,7 +173,7 @@ StandardImageViewer<TImage,TVectorData>
m_View->GetFullWidget()->show();
m_View->GetZoomWidget()->show();
m_CurveWidget->show();
// Update the rendering model
m_RenderingModel->Update();
......@@ -193,7 +197,7 @@ StandardImageViewer<TImage,TVectorData>
rhistogram->SetHistogram(m_ImageLayer->GetHistogramList()->GetNthElement(m_RenderingFunction->GetRedChannelIndex()));
rhistogram->SetHistogramColor(red);
rhistogram->SetLabelColor(red);
typename HistogramCurveType::Pointer ghistogram = HistogramCurveType::New();
ghistogram->SetHistogram(m_ImageLayer->GetHistogramList()->GetNthElement(m_RenderingFunction->GetGreenChannelIndex()));
ghistogram->SetHistogramColor(green);
......@@ -207,7 +211,7 @@ StandardImageViewer<TImage,TVectorData>
m_CurveWidget->AddCurve(ghistogram);
m_CurveWidget->AddCurve(bhistogram);
m_CurveWidget->SetXAxisLabel("Pixels");
m_CurveWidget->SetYAxisLabel("Amount");
m_CurveWidget->SetYAxisLabel("Frequency");
}
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment