diff --git a/Code/Visu/otbGLVectorImageViewBase.h b/Code/Visu/otbGLVectorImageViewBase.h index f926bdf483d15094915b8a3432ad4a7a754c34f8..5dbc234845ca42152db84d47f1922ed1c9cfbc4a 100755 --- a/Code/Visu/otbGLVectorImageViewBase.h +++ b/Code/Visu/otbGLVectorImageViewBase.h @@ -16,27 +16,25 @@ #include <FL/Fl.H> #include <FL/fl_draw.H> #include <FL/Fl_Gl_Window.H> +#include <FL/Fl_Double_Window.H> #include <vector> #include <string> -#include "itkColorTable.h" #include "itkImage.h" #include "itkMacro.h" #include "otbVectorImageView.h" -//#include "otbImageViewer.h" - namespace otb { template <class TPixel, class OverlayPixelType> class ImageViewer; -/** -* GLVectorImageViewBase : Derived from abstract class ImageView and Fl_Gl_Window -* See ImageView.h for details... - **/ +/** \class GLVectorImageViewBase +* \brief Base class for image view +* Contain all algorithms and functionnalities for display an image in a window. +*/ template <class TPixel, class OverlayPixelType> class ITK_EXPORT GLVectorImageViewBase : public VectorImageView<TPixel>, public Fl_Gl_Window diff --git a/Code/Visu/otbGLVectorImageViewBase.txx b/Code/Visu/otbGLVectorImageViewBase.txx index 5b12b98a6a591280ecf368955c684c24cd87337e..dd03daf1b95930e93914da1073fcfb75bc5bd74e 100755 --- a/Code/Visu/otbGLVectorImageViewBase.txx +++ b/Code/Visu/otbGLVectorImageViewBase.txx @@ -508,20 +508,14 @@ SetWinImData(const RegionType & zone) if(j-lWinMinX >= (int)this->cWinDataSizeX) continue; - switch( this->cImageMode ) + pixelInput = lInpuPtr->GetPixel(ind); + pixelOutput.Reserve( lInpuPtr->GetVectorLength() ); + // Traitement sur les canaux selectionnes. + for ( nbChannels = 0 ; nbChannels < this->m_ChannelsWorks.size() ; nbChannels++) { - default: - case IMG_VAL: - pixelInput = lInpuPtr->GetPixel(ind); - pixelOutput.Reserve( lInpuPtr->GetVectorLength() ); - // Traitement sur les canaux selectionnes. - for ( nbChannels = 0 ; nbChannels < this->m_ChannelsWorks.size() ; nbChannels++) - { - channelIn = this->m_ChannelsWorks[nbChannels] - 1; - pixelOutput[channelIn] = static_cast<float>(pixelInput[channelIn]); - pixelOutput[channelIn] = (float)( (pixelOutput[channelIn]-this->cIWMin) * lCoef); - } - break; + channelIn = this->m_ChannelsWorks[nbChannels] - 1; + pixelOutput[channelIn] = static_cast<float>(pixelInput[channelIn]); + pixelOutput[channelIn] = (float)( (pixelOutput[channelIn]-this->cIWMin) * lCoef); } // On s'assure que les valeurs sont dans [0,255] for ( nbChannels = 0 ; nbChannels < this->m_ChannelsWorks.size() ; nbChannels++) diff --git a/Code/Visu/otbImageViewer.h b/Code/Visu/otbImageViewer.h index 64a1a301d65ec672832482e1090043e24282f7a2..3405935259bbd262e3f7ebf7eff83bc5bd855fe0 100755 --- a/Code/Visu/otbImageViewer.h +++ b/Code/Visu/otbImageViewer.h @@ -28,7 +28,11 @@ namespace otb /** \class ImageViewer * \brief Base class for viewing an image. * - * This Viewer.... + * This viewer show the image with two (or three) windows display. + * The 'Principal' window display de the image in entier resolution. + * The zoom window display a zoom of a part of the image. + * If the image is big, a Scroll window is create, which contain the original image shrinked. + * Use FLTK gui. * */ template <class TPixel, class TOverlayPixel> diff --git a/Code/Visu/otbImageViewer.txx b/Code/Visu/otbImageViewer.txx index 3f1462af83058316036c880e72e23c5c8fcb9adf..b6cbf40c05621e9bec7d0fe918aa607d088a8e0f 100755 --- a/Code/Visu/otbImageViewer.txx +++ b/Code/Visu/otbImageViewer.txx @@ -62,29 +62,30 @@ void ImageViewer<TPixel,TOverlayPixel> ::PrincipalResize(void) { - IndexType lIndex; - SizeType lSize; - lIndex[0] = static_cast<unsigned long>((m_InputImage->GetLargestPossibleRegion().GetSize()[0] - m_PrincipalView->sizeX())/2); - lIndex[1] = static_cast<unsigned long>((m_InputImage->GetLargestPossibleRegion().GetSize()[1] - m_PrincipalView->sizeY())/2); - lSize[0] = m_PrincipalView->sizeX(); - lSize[1] = m_PrincipalView->sizeY(); - RegionType lNewRegion; - lNewRegion.SetIndex(lIndex); - lNewRegion.SetSize(lSize); - //Update principal image - ExtractImagePrincipal( lNewRegion ); - - //Reconstruit la fenetre principal - m_PrincipalView->Show(); - - //Maj de la fenetre Zoom - m_ZoomView->SetInput( m_PrincipalImage ); - IndexType lNewCenter = m_PrincipalView->GetCenterRegion( m_PrincipalView->GetViewImageRegion() ); - this->PrincipalAction( lNewCenter ); - //Dessine le rectangle sur l'image Scroll if ( m_ScrollImageView == true ) { + + IndexType lIndex; + SizeType lSize; + lIndex[0] = static_cast<unsigned long>((m_InputImage->GetLargestPossibleRegion().GetSize()[0] - m_PrincipalView->sizeX())/2); + lIndex[1] = static_cast<unsigned long>((m_InputImage->GetLargestPossibleRegion().GetSize()[1] - m_PrincipalView->sizeY())/2); + lSize[0] = m_PrincipalView->sizeX(); + lSize[1] = m_PrincipalView->sizeY(); + RegionType lNewRegion; + lNewRegion.SetIndex(lIndex); + lNewRegion.SetSize(lSize); + //Update principal image + ExtractImagePrincipal( lNewRegion ); + + //Reconstruit la fenetre principal + m_PrincipalView->Show(); + + //Maj de la fenetre Zoom + m_ZoomView->SetInput( m_PrincipalImage ); + IndexType lNewCenter = m_PrincipalView->GetCenterRegion( m_PrincipalView->GetViewImageRegion() ); + this->PrincipalAction( lNewCenter ); + m_ScrollView->SetDrawViewRectangle( ImageViewBaseType::ShrinkRegion(m_PrincipalView->GetViewImageRegion(),(float)1./(float)m_ShrinkFactors ) ); m_ScrollView->Show(); } diff --git a/Code/Visu/otbPrincipalImageView.h b/Code/Visu/otbPrincipalImageView.h index 6f16794ed1d4534ac3e37944151a00eb08b62629..9b2e0f8cc9c9bb0c57d01350834570946eaf1f00 100755 --- a/Code/Visu/otbPrincipalImageView.h +++ b/Code/Visu/otbPrincipalImageView.h @@ -23,8 +23,10 @@ namespace otb { /** -* GLImageView : Derived from abstract class ImageView and Fl_Gl_Window -* See ImageView.h for details... +* \class PrincipalImageView +* \brief Class for viewing an image in entier resolution +* +* See GLVectorImageViewBase.h for details... **/ template <class TPixel, class OverlayPixelType> class ITK_EXPORT PrincipalImageView : public GLVectorImageViewBase<TPixel,OverlayPixelType> @@ -53,6 +55,7 @@ public: virtual int handle(int event); + /** Show the image (display the window) */ virtual void Show(void) { this->BuildWithImageRegion(); diff --git a/Code/Visu/otbScrollImageView.h b/Code/Visu/otbScrollImageView.h index 960942a52a05b2f694488e93114d7895d6dc422f..c24ab38ce62f7597ffb390bfca18d8a9cc8b9d9c 100755 --- a/Code/Visu/otbScrollImageView.h +++ b/Code/Visu/otbScrollImageView.h @@ -23,8 +23,10 @@ namespace otb { /** -* GLImageView : Derived from abstract class ImageView and Fl_Gl_Window -* See ImageView.h for details... +* \class ScrollImageView +* \brief Class for viewing an scroll image +* +* See GLVectorImageViewBase.h for details... **/ template <class TPixel, class OverlayPixelType> class ITK_EXPORT ScrollImageView : public GLVectorImageViewBase<TPixel,OverlayPixelType> @@ -53,6 +55,7 @@ public: virtual int handle(int event); + /** Show the image (display the window) */ virtual void Show(void) { this->BuildWithImageRegion(); diff --git a/Code/Visu/otbVectorImageView.h b/Code/Visu/otbVectorImageView.h index 230cc05e726c54ae31a918c9c5ede6d791d7aeef..b466ae284b265f6c0bd3b8a20e9f0efba94b448e 100755 --- a/Code/Visu/otbVectorImageView.h +++ b/Code/Visu/otbVectorImageView.h @@ -19,86 +19,15 @@ #include <itkProcessObject.h> #include <itkVectorImage.h> -//#include <fltkUtils.h> #include <list> -#include <FL/fl_file_chooser.H> +//#include <FL/fl_file_chooser.H> #include <fstream> -//using namespace itk; - namespace otb { - -/*! Clicking in a window will cause different events -* NOP = nothing -* SELECT = report pixel info -*/ -const int NUM_ClickModeTypes = 3; -typedef enum {CM_NOP, CM_SELECT, CM_BOX} ClickModeType; -const char ClickModeTypeName[3][7] = - {{'N', 'O', 'P', '\0', ' ', ' ', ' '}, - {'S', 'e', 'l', 'e', 'c', 't', '\0'}, - {'B', 'o', 'x', '\0', ' ', ' ', ' '}}; - - /*! Handling of values outside intensity window range - values above - * and below can be handled separately - * IW_MIN = set values outside range to min value - * IW_MAX = set values outside range to max value - * IW_FLIP = rescale values to be within range by flipping -*/ -const int NUM_ImageModeTypes = 8; -typedef enum {IMG_VAL, IMG_INV, IMG_LOG, IMG_DX, IMG_DY, IMG_DZ, - IMG_BLEND, IMG_MIP} ImageModeType; -const char ImageModeTypeName[8][8] = - {{'V', 'a', 'l', 'u', 'e', '\0', ' ', ' '}, - {'I', 'n', 'v', 'e', 'r', 's', 'e', '\0'}, - {'L', 'o', 'g', '\0', ' ', ' ', ' ', ' '}, - {'D', 'e', 'r', 'i', 'v', '-', 'X', '\0'}, - {'D', 'e', 'r', 'i', 'v', '-', 'Y', '\0'}, - {'D', 'e', 'r', 'i', 'v', '-', 'Z', '\0'}, - {'B', 'l', 'e', 'n', 'd', '\0', ' ', ' '}, - {'M', 'I', 'P', '\0', ' ', ' ', ' ', ' '}}; - -const int NUM_IWModeTypes = 3; -typedef enum {IW_MIN, IW_MAX, IW_FLIP} IWModeType; -const char IWModeTypeName[3][5] = - {{'M', 'i', 'n', '\0', ' '}, - {'M', 'a', 'x', '\0', ' '}, - {'F', 'l', 'i', 'p', '\0'}}; - - /*! Structure clickPoint to store the x,y,z and intensity value of a - * point in the image -*/ -class ClickPoint - { - public: - ClickPoint() - : x(0),y(0),/*z(0),*/value(0){} - ClickPoint( const ClickPoint & p ) - { x = p.x; y = p.y; /*z = p.z; */value = p.value; } - ClickPoint(float _x,float _y,/*float _z,*/double v) - : x(_x),y(_y),/*z(_z),*/value(v){} - public: - float x, y/*, z*/; - double value; - }; - - -/*! Multifunction slice-by-slice viewer -* Allows for viewing the coronal, axial, and sagittal slices of -* a 3D volume. Operates independent of any GUI/via system in this -* base class (except fltkUtils.h - which could also be abstracted). -* To learn all of the available viewing options when viewing an image, -* press 'h' in the window. -* This is a virtual base class, which provides most of the data -* members and methods slice viewers would need. -* To get a concrete slice-viewer, inherit this class along with a -* windowing class (example: Fl_window or Fl_Gl_Window). -* -* /author Stephen R. Aylward -* -* /date 11/22/99 +/** \class VectorImageView +* \brief Base class for image view */ template <class TPixel> class ITK_EXPORT VectorImageView : public itk::ProcessObject @@ -150,7 +79,7 @@ class ITK_EXPORT VectorImageView : public itk::ProcessObject void * cIWArg; void (* cIWArgCallBack)(void * iwArg); - ImageModeType cImageMode; +// ImageModeType cImageMode; float cWinZoom; unsigned int cWinSizeX; @@ -224,10 +153,6 @@ class ITK_EXPORT VectorImageView : public itk::ProcessObject void iwCallBack(void (*newIWArgCallBack)(void *), void * newIWArg); - - void imageMode(ImageModeType newImageMode); - ImageModeType imageMode(void); - virtual void size(int w, int h); virtual int sizeX(void){return cW;} virtual int sizeY(void){return cH;} diff --git a/Code/Visu/otbVectorImageView.txx b/Code/Visu/otbVectorImageView.txx index f57baaa9441f2613701102f43ae0564862a3b5f3..e13b76f6971d83b1d81e50f909b2ba09bb03b116 100755 --- a/Code/Visu/otbVectorImageView.txx +++ b/Code/Visu/otbVectorImageView.txx @@ -35,7 +35,6 @@ VectorImageView<TPixel>::Init(int x, int y, int w, int h, const char * ) cIWMin = 0; cIWMax = 0; - cImageMode = IMG_VAL; cWinZoom = 1; cWinSizeX = 0; @@ -199,32 +198,6 @@ float VectorImageView<TPixel>::iwMax(void) return cIWMax; } -// -// -// -template <class TPixel> -void VectorImageView<TPixel>::imageMode(ImageModeType newImageMode) - { - cImageMode = newImageMode; - if(cIWCallBack != NULL) - cIWCallBack(); - if(cIWArgCallBack != NULL) - cIWArgCallBack(cIWArg); - } - - - - -template <class TPixel> -ImageModeType VectorImageView<TPixel>::imageMode(void) - { - return cImageMode; - - } - - - - // // template <class TPixel> diff --git a/Code/Visu/otbZoomImageView.h b/Code/Visu/otbZoomImageView.h index d5eb24b6ee2bc48357911d54edd53202d69abef8..0ee9b9434d59634c7ef710b82964de12b3bed6ce 100755 --- a/Code/Visu/otbZoomImageView.h +++ b/Code/Visu/otbZoomImageView.h @@ -23,8 +23,10 @@ namespace otb { /** -* GLImageView : Derived from abstract class ImageView and Fl_Gl_Window -* See ImageView.h for details... +* \class ZoomImageView +* \brief Class for viewing an zoom image +* +* See GLVectorImageViewBase.h for details... **/ template <class TPixel, class OverlayPixelType> class ITK_EXPORT ZoomImageView : public GLVectorImageViewBase<TPixel,OverlayPixelType> @@ -53,6 +55,7 @@ public: virtual int handle(int event); + /** Show the image (display the window) */ virtual void Show(void) { this->BuildWithWindowRegion(4);