diff --git a/Code/Visu/otbGLVectorImageView.h b/Code/Visu/otbGLVectorImageView.h deleted file mode 100755 index b2e912d62becc7573824802f6edd518a94019c9b..0000000000000000000000000000000000000000 --- a/Code/Visu/otbGLVectorImageView.h +++ /dev/null @@ -1,119 +0,0 @@ -/*========================================================================= - - Programme : OTB (ORFEO ToolBox) - Auteurs : CS - T.Feuvrier - Language : C++ - Date : 4 avril 2005 - Version : - Role : Classe permettant de gérer l'affichage d'une image dans un fenetre - $Id$ - -=========================================================================*/ -#ifndef otbGLVectorImageView_h -#define otbGLVectorImageView_h - -#include <FL/gl.h> -#include <FL/Fl.H> -#include <FL/fl_draw.H> -#include <FL/Fl_Gl_Window.H> -#include <FL/Fl_Double_Window.H> - -#include "itkColorTable.h" -#include "itkVectorImage.h" - -#include "otbGLVectorImageViewBase.h" - -namespace otb -{ - -/** -* GLImageView : Derived from abstract class ImageView and Fl_Gl_Window -* See ImageView.h for details... - **/ -template <class TPixel, class OverlayPixelType> -class ITK_EXPORT GLVectorImageView : public GLVectorImageViewBase<TPixel,OverlayPixelType> - -{ -public: - typedef GLVectorImageView Self; - typedef GLVectorImageViewBase<TPixel,OverlayPixelType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro(GLVectorImageView,GLVectorImageViewBase); - - - typedef typename Superclass::ImageType ImageType; - typedef typename Superclass::ImagePointer ImagePointer; - typedef typename Superclass::ImageConstPointer ImageConstPointer; - typedef typename Superclass::RegionType RegionType; - typedef typename Superclass::SizeType SizeType; - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::PixelType PixelType; - - itkSetMacro(CenterPointImage,IndexType); - itkGetConstReferenceMacro(CenterPointImage,IndexType); - itkSetMacro(DrawViewRectangle,RegionType); - itkGetConstReferenceMacro(DrawViewRectangle,RegionType); - -protected: - -/*! FLTK required constructor - must use imData() to complete - definition */ - GLVectorImageView(); - /*! Standard destructor */ - virtual ~GLVectorImageView(void); - - IndexType m_CenterPointImage; - -public: - - virtual IndexType GetCenterRegion( const RegionType & zone ); - static RegionType ShrinkRegion( const RegionType & zone, const float shrinkfactor ); - virtual RegionType GetViewRegion( const IndexType & centerPointImage ); - virtual RegionType GetViewRegion( const RegionType & region, const IndexType & centerPointImage ); - virtual RegionType TranslateImageRegionToWindowRegion( const RegionType & imageRegion, const RegionType & sousimageRegion, const int windowWidth, const int windowHeight); - - /** Update the view region, with the new zoom and new Window sizes */ - virtual void MajViewRegion(void); - virtual void PrintInfos(void); - virtual void BuildWithImageRegion(); - virtual void BuildWithWindowRegion(const int zoom); - - virtual IndexType WindowCoord2ImageCoord( const IndexType & index )const; - virtual SizeType WindowSize2ImageSize( const SizeType & size )const; - virtual RegionType WindowZone2ImageRegion( const RegionType & zone )const; - - virtual void Init(int x, int y, int w, int h, const char *l); - - virtual void FinalizeInitialisation(void); - - virtual void size(int w, int h); - virtual void resize(int x, int y, int w, int h); - - virtual void update(); - virtual void draw(); -// virtual int handle(int event); - virtual void SetDoubleWindow( Fl_Double_Window * pflDoubleWindow) - { - m_flDoubleWindow = pflDoubleWindow; - } - protected : - bool m_ViewRectangle; - RegionType m_DrawViewRectangle; - Fl_Double_Window * m_flDoubleWindow; -}; - -} //namespace - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbGLVectorImageView.txx" -#endif - - -#endif - diff --git a/Code/Visu/otbGLVectorImageView.txx b/Code/Visu/otbGLVectorImageView.txx deleted file mode 100755 index 721ae842788b542361a5dc7f2269802414d7855b..0000000000000000000000000000000000000000 --- a/Code/Visu/otbGLVectorImageView.txx +++ /dev/null @@ -1,407 +0,0 @@ -#ifndef otbGLVectorImageViewBase_txx -#define otbGLVectorImageViewBase_txx - -#include "otbGLVectorImageViewBase.h" -#include "itkVariableLengthVector.h" - -#include <math.h> - -namespace otb -{ - -template <class TPixel, class OverlayPixelType> -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -//GLImageView(int x, int y, int w, int h, const char *l): -//VectorImageView<TPixel>(x, y, w, h, l), Fl_Gl_Window(x, y, w, h, l) -GLVectorImageViewBase() : GLVectorImageViewBaseBase<TPixel, OverlayPixelType>() - { - } - -template <class TPixel, class OverlayPixelType> -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -~GLVectorImageViewBase() -{ - -} - -template <class TPixel, class OverlayPixelType> -void -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -Init(int x, int y, int w, int h, const char * l) -{ - //Methode sur Fl_Gl_Window - this->resize(x,y,w,h); - //Et le "l" !!! (THOMAS) -} - -// -// Set the input image to be displayed -// Warning: the current overlay is destroyed if the size of the image -// is different from the size of the overlay. -// -// Initialise la class a partir du "m_ViewImageRegion" préalablement initialisé -template <class TPixel, class OverlayPixelType> -void -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -FinalizeInitialisation(void) -{ - m_CenterPointImage = GetCenterRegion(this->m_ViewImageRegion); - - SizeType imSize = this->GetInput()->GetRequestedRegion().GetSize(); - - this->cDimSize[0]=imSize[0]; - this->cDimSize[1]=imSize[1]; - - this->CalculeDataMinMax( this->m_ViewImageRegion, - this->cDataMin, - this->cDataMax); - - this->cIWMin = this->cDataMin; - this->cIWMax = this->cDataMax; - - this->cWinDataSizeX = imSize[0]; - if( this->cWinDataSizeX < imSize[1] ) - { - this->cWinDataSizeX = imSize[1]; - } - this->cWinDataSizeY = this->cWinDataSizeX; - - if(this->cWinImData != NULL) - { - delete [] this->cWinImData; - } - this->cWinImData = new unsigned char[ this->cWinDataSizeX * this->cWinDataSizeY * this->m_NbDim ]; - - this->cViewImData = true; - this->cValidImData = true; - -} - - -template <class TPixel, class OverlayPixelType> -typename GLVectorImageViewBase<TPixel, OverlayPixelType>::IndexType -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -WindowCoord2ImageCoord( const IndexType & index )const -{ - IndexType lCoord; - RegionType lRegion = this->GetViewImageRegion(); - for( int i=0 ; i < 2 ; i++) - { - lCoord[i] = (unsigned long)(index[i]/this->cWinZoom) + lRegion.GetIndex()[i]; - } - return lCoord; -} -template <class TPixel, class OverlayPixelType> -typename GLVectorImageViewBase<TPixel, OverlayPixelType>::SizeType -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -WindowSize2ImageSize( const SizeType & size )const -{ - SizeType lSize; - for( int i=0 ; i < 2 ; i++) - { - lSize[i] = (unsigned long)(size[i]/this->cWinZoom); - } - return lSize; -} - -template <class TPixel, class OverlayPixelType> -typename GLVectorImageViewBase<TPixel, OverlayPixelType>::RegionType -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -WindowZone2ImageRegion( const RegionType & zone )const -{ - RegionType lRegion; - SizeType lSize = this->WindowSize2ImageSize(zone.GetSize()); - IndexType lIndex = this->WindowCoord2ImageCoord(zone.GetIndex()); - lRegion.SetIndex( lIndex ); - lRegion.SetSize( lSize ); - return lRegion; -} - - -template <class TPixel, class OverlayPixelType> -typename GLVectorImageViewBase<TPixel, OverlayPixelType>::IndexType -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -GetCenterRegion( const RegionType & zone ) -{ - IndexType lCenter; - lCenter[0] = zone.GetIndex()[0] + zone.GetSize()[0] / 2; - lCenter[1] = zone.GetIndex()[1] + zone.GetSize()[1] / 2; - return lCenter; -} - -template <class TPixel, class OverlayPixelType> -typename GLVectorImageViewBase<TPixel, OverlayPixelType>::RegionType -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -ShrinkRegion( const RegionType & zone, const float shrinkfactor ) -{ - RegionType lRegion; - SizeType lSize; - IndexType lIndex; - for( int i=0 ; i<2 ; i++) - { - lSize[i] = (int) (shrinkfactor*zone.GetSize()[i]); - lIndex[i] = (int) (shrinkfactor*zone.GetIndex()[i]); - } - lRegion.SetIndex( lIndex ); - lRegion.SetSize( lSize ); - return (lRegion); -} - - -template <class TPixel, class OverlayPixelType> -typename GLVectorImageViewBase<TPixel, OverlayPixelType>::RegionType -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -GetViewRegion( const IndexType & centerPointImage ) -{ - return( GetViewRegion( this->GetInput()->GetRequestedRegion(), centerPointImage) ); -} - - -template <class TPixel, class OverlayPixelType> -typename GLVectorImageViewBase<TPixel, OverlayPixelType>::RegionType -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -GetViewRegion( const RegionType & region, const IndexType & centerPointImage ) -{ - RegionType lNewViewRegion; - RegionType lImageRegionComplete = region; - SizeType lSize; - IndexType lIndex; - double scale0 = this->cWinZoom; - double scale1 = this->cWinZoom; - lSize[0] = (int)( this->cW / scale0 ); - lSize[1] = (int)( this->cH / scale1 ); - //Reajuste le centre si la zone zoom est sur les bords - for( int i=0 ; i < 2 ; i++) - { - lIndex[i] = centerPointImage[i] - lSize[i]/2; - if ( lIndex[i] < lImageRegionComplete.GetIndex()[i] ) - { - lIndex[i] = lImageRegionComplete.GetIndex()[i]; - } - else if( lIndex[i] + lSize[i] > lImageRegionComplete.GetIndex()[i] + lImageRegionComplete.GetSize()[i] ) - { - lIndex[i] = lImageRegionComplete.GetIndex()[i] + lImageRegionComplete.GetSize()[i] - lSize[i]; - } - //Si la fenetre est plus grande en pixel) que l'image reelle, on réajuste la taille de l'image - if( lSize[i] > lImageRegionComplete.GetSize()[i] ) - { - lSize[i] = lImageRegionComplete.GetSize()[i]; - } - } - lNewViewRegion.SetIndex( lIndex ); - lNewViewRegion.SetSize( lSize ); - return(lNewViewRegion); -} -template <class TPixel, class OverlayPixelType> -typename GLVectorImageViewBase<TPixel, OverlayPixelType>::RegionType -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -TranslateImageRegionToWindowRegion( const RegionType & imageRegion, const RegionType & sousimageRegion, const int windowWidth, const int windowHeight) -{ - RegionType lRegion; - SizeType lSize; - IndexType lIndex ; - for( int i=0 ; i < 2 ; i++) - { - lIndex[i] = sousimageRegion.GetIndex()[i] - imageRegion.GetIndex()[i]; - lSize[i] = sousimageRegion.GetSize()[i]; - } - lRegion.SetIndex( lIndex ); - lRegion.SetSize( lSize ); - return(lRegion); -} - -template <class TPixel, class OverlayPixelType> -void -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -MajViewRegion(void) -{ - //Position du centre de l'image en coordonnees image - this->SetViewImageRegion( GetViewRegion(m_CenterPointImage) ); -} - -template <class TPixel, class OverlayPixelType> -void -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -BuildWithImageRegion() -{ - this->SetViewImageRegion( this->GetInput()->GetRequestedRegion() ); - this->cWinZoom = 1.; - //Termine l'initialisation - FinalizeInitialisation(); -} - -template <class TPixel, class OverlayPixelType> -void -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -BuildWithWindowRegion(const int zoom) -{ - RegionType lRegion; - RegionType lWindow; - SizeType lSize; - IndexType lIndex; - - lSize[0] = this->cW; - lSize[1] = this->cH; - lWindow.SetSize(lSize); - for( int i=0 ; i < 2 ; i++) - { - lSize[i] = lWindow.GetSize()[i] / zoom; - lIndex[i] = this->GetInput()->GetRequestedRegion().GetIndex()[i] - + this->GetInput()->GetRequestedRegion().GetSize()[i] / 2 - - lSize[i] / 2; - } - lRegion.SetIndex(lIndex); - lRegion.SetSize(lSize); - this->m_ViewImageRegion = lRegion; - this->cWinZoom = (float)zoom; - - //Termine l'initialisation - FinalizeInitialisation(); -} - -template <class TPixel, class OverlayPixelType> -void -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -PrintInfos(void) -{ -std::cout << this->GetNameOfClass()<< std::endl; -std::cout << "- cW, cH : ["<<this->cW<<","<<this->cH<<"]"<< std::endl; -std::cout << "- zoom : "<<this->winZoom()<< std::endl; -std::cout << "- zoom : "<<this->cWinZoom<< std::endl; -std::cout << "- m_CenterPointImage : "<<m_CenterPointImage<< std::endl; -std::cout << "- m_ViewImageRegion : "<<this->m_ViewImageRegion<< std::endl; -} - -// -// -template <class TPixel, class OverlayPixelType> -void -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -update() -{ - if( this->cValidImData == false ) - { - return; - } - - //Mise a jour de la fenetre - this->MajViewRegion(); - - //Update d'ITK - this->Update(); - - memset( this->cWinImData, 0, this->cWinDataSizeX*this->cWinDataSizeY*this->m_NbDim ); - - //Lecture des pixels et initialisation du buffer - this->SetWinImData( this->m_ViewImageRegion ); - - this->redraw(); -} - -template <class TPixel, class OverlayPixelType> -void GLVectorImageViewBase<TPixel, OverlayPixelType>::size(int w, int h) - { - VectorImageView<TPixel>::size(w, h); - Fl_Gl_Window::size(w, h); - this->update(); - this->redraw(); - } - - -template <class TPixel, class OverlayPixelType> -void -GLVectorImageViewBase<TPixel, OverlayPixelType>:: -resize(int x, int y, int w, int h) - { - VectorImageView<TPixel>::resize(x, y, w, h); - Fl_Gl_Window::resize(x, y, w, h); - this->update(); - this->redraw(); - } - -template <class TPixel, class OverlayPixelType> -void GLVectorImageViewBase<TPixel, OverlayPixelType>::draw(void) -{ - if( !this->valid() ) - { - glClearColor((float)0.0, (float)0.0, (float)0.0, (float)0.0); - glShadeModel(GL_FLAT); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); //if you don't include this - //image size differences distort - //glPixelStorei(GL_PACK_ALIGNMENT, 1); - } - else - { - glClear(GL_COLOR_BUFFER_BIT); //this clears and paints to black - - glMatrixMode(GL_MODELVIEW); //clear previous 3D draw params - glLoadIdentity(); - - glMatrixMode(GL_PROJECTION); - this->ortho(); - - if( !this->GetInput() ) - { - return; - } - - double scale0 = this->cWinZoom; - double scale1 = this->cWinZoom; - - int originX = 0; - int originY = 0; -//THOMAS - if( this->GetViewImageRegion().GetSize()[0]*scale0 < this->cW ) - { - originX = static_cast<int>( (this->cW - this->GetViewImageRegion().GetSize()[0]*scale0)/2); - } - if( this->GetViewImageRegion().GetSize()[1]*scale1 < this->cH ) - { - originY = static_cast<int>( (this->cH - this->GetViewImageRegion().GetSize()[1]*scale1)/2); - } - - glRasterPos2i( originX , this->cH - originY ); - glPixelZoom( scale0 , - scale1 ); - - if( (this->cValidImData==true) && (this->cViewImData == true) ) - { - if ( this->m_ModeView == Superclass::GRAY_LEVEL ) - { - glDrawPixels( this->cWinDataSizeX, - this->cWinDataSizeY, - GL_LUMINANCE, - GL_UNSIGNED_BYTE, - this->cWinImData ); - } - else - { - glDrawPixels( this->cWinDataSizeX, - this->cWinDataSizeY, - GL_RGB, - GL_UNSIGNED_BYTE, - this->cWinImData ); - } - } - - if( m_ViewRectangle == true ) - { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(1., 0., 0., (float)0.75); - gl_font(FL_TIMES_BOLD, 12); - RegionType lDrawRectangle = TranslateImageRegionToWindowRegion( this->GetViewImageRegion(), m_DrawViewRectangle, this->cW, this->cH); - gl_rect( lDrawRectangle.GetIndex()[0], - this->cH - lDrawRectangle.GetIndex()[1] - lDrawRectangle.GetSize() [1], - lDrawRectangle.GetSize() [0], - lDrawRectangle.GetSize() [1]); - glDisable(GL_BLEND); - } - - } -} - - -}; //namespace -#endif - diff --git a/Code/Visu/otbVectorImageViewerGUI.fl b/Code/Visu/otbVectorImageViewerGUI.fl deleted file mode 100755 index 05d34e082a89030108c2dfd6a5506c463fc6d268..0000000000000000000000000000000000000000 --- a/Code/Visu/otbVectorImageViewerGUI.fl +++ /dev/null @@ -1,40 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0107 -header_name {.h} -code_name {.cxx} -class otbVectorImageViewerGUI {open -} { - Function {otbVectorImageViewerGUI()} {} {} - Function {~otbVectorImageViewerGUI()} {selected return_type virtual - } {} - Function {CreateGUI()} {open - } { - Fl_Window iviewWindow {open - xywh {560 53 420 490} type Double labelsize 10 resizable visible - } { - Fl_Group glWindowGroup {open - xywh {5 5 410 480} - } { - Fl_Box {} { - label {3D Win} - xywh {5 5 410 480} box EMBOSSED_BOX - code0 {\#include <otbGLVectorImageView.h>} - code1 {CreateGLSliceView( glWindowGroup, o );} - class Fl_Gl_Window - } - } - } - } - Function {CreateGLSliceView( Fl_Group *,Fl_Gl_Window * w )} {open return_type {virtual void} - } {} - Function {SetImage( itk::ImageBase<3> * img )} {return_type {virtual void} - } {} - Function {Show(void)} {return_type {virtual void} - } {} - Function {Hide(void)} {return_type {virtual void} - } {} - Function {Update(void)} {return_type {virtual void} - } {} - Function {Synchronize(void)} {return_type {virtual void} - } {} -} diff --git a/Code/Visu/otbVectorImageViewerSimple.h b/Code/Visu/otbVectorImageViewerSimple.h deleted file mode 100755 index 0351b5b15b31cfbbc00451f5a26ccd82ea0b4fd0..0000000000000000000000000000000000000000 --- a/Code/Visu/otbVectorImageViewerSimple.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef __otbVectorImageViewerSimple_h -#define __otbVectorImageViewerSimple_h - -#include "otbGLVectorImageView.h" -#include "otbVectorImageViewerGUI.h" - -namespace otb -{ - -template <class TPixel, class OverlayPixelType> -class VectorImageViewerSimple : public itk::ProcessObject, - public otbVectorImageViewerGUI - -{ -public: - - /** - * Standard "Self" typedef. - */ - typedef VectorImageViewerSimple Self; - typedef itk::ProcessObject Superclass; - - /** - * Smart pointer typedef support. - */ - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro(VectorImageViewerSimple,itk::ProcessObject); - - - typedef itk::Image< OverlayPixelType, 3 > OverlayType; - typedef GLVectorImageView< TPixel, OverlayPixelType > GLVectorImageViewType; - typedef typename GLVectorImageViewType::Pointer GLVectorImageViewPointer; - typedef typename GLVectorImageViewType::ColorTablePointer ColorTablePointer; - typedef typename GLVectorImageViewType::ImageType ImageType; - - - - VectorImageViewerSimple(); - virtual ~VectorImageViewerSimple(); - virtual void SetImage(itk::ImageBase<3> * img); - virtual void Show(void); - virtual void Hide(void); - virtual void Update(void); - virtual void Synchronize(void); - virtual void PrepareIHM(void); - virtual void CreateGLSliceView( Fl_Group * g , Fl_Gl_Window * w ); - virtual void SetLabel( const char * ); - virtual void ClickSelectCallBack( - void (*newClickSelectArgCallBack)(float, float, - float, float, - void *), - void * newClickSelectArg); - - virtual void SetGrayLevelChannel(int pChannel) - { - glSliceView->SetGrayLevelChannel(pChannel); - } - virtual void SetRedChannel(int pChannel) - { - glSliceView->SetRedChannel(pChannel); - } - virtual void SetGreenChannel(int pChannel) - { - glSliceView->SetGreenChannel(pChannel); - } - virtual void SetBlueChannel(int pChannel) - { - glSliceView->SetBlueChannel(pChannel); - } - virtual void SetRGBChannels(int pRedChannel,int pGreenChannel, int pBlueChannel) - { - glSliceView->SetRGBChannels(pRedChannel,pGreenChannel,pBlueChannel); - } - -private: -// GLImageViewType * glSliceView; - GLVectorImageViewPointer glSliceView; - -}; - - -} // end namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbVectorImageViewerSimple.txx" -#endif - - -#endif diff --git a/Code/Visu/otbVectorImageViewerSimple.txx b/Code/Visu/otbVectorImageViewerSimple.txx deleted file mode 100755 index fba3aee14cd0d23e5e28310e78481948ff5cf95b..0000000000000000000000000000000000000000 --- a/Code/Visu/otbVectorImageViewerSimple.txx +++ /dev/null @@ -1,177 +0,0 @@ -#ifndef _otbVectorImageViewerSimple_txx -#define _otbVectorImageViewerSimple_txx - -#include "otbVectorImageViewerSimple.h" - -namespace otb -{ - -template <class TPixel, class OverlayPixelType> -VectorImageViewerSimple<TPixel,OverlayPixelType> -::VectorImageViewerSimple() -{ -// glSliceView = 0; - CreateGUI(); -} - - - -template <class TPixel, class OverlayPixelType> -VectorImageViewerSimple<TPixel,OverlayPixelType> -::~VectorImageViewerSimple() -{ - -} - - - - -template <class TPixel, class OverlayPixelType> -void -VectorImageViewerSimple<TPixel,OverlayPixelType> -::SetImage(itk::ImageBase<3> * img) -{ - ImageType * image = dynamic_cast<ImageType *>( img ); -// glSliceView->SetInputImage( image ); - glSliceView->SetInput( image ); - this->Modified(); - Synchronize(); -} - -template <class TPixel, class OverlayPixelType> -void -VectorImageViewerSimple<TPixel,OverlayPixelType> -::Show(void) -{ - this->Update(); -/* static bool firstTime = true; - iviewWindow->show(); - glSliceView->show(); - glSliceView->update(); - if( firstTime ) - { - firstTime = false; - Fl::check(); - glSliceView->redraw(); - Fl::check(); - } - */ -} - - - - - -template <class TPixel, class OverlayPixelType> -void -VectorImageViewerSimple<TPixel,OverlayPixelType> -::Hide(void) -{ - iviewWindow->hide(); -} - - -template <class TPixel, class OverlayPixelType> -void -VectorImageViewerSimple<TPixel,OverlayPixelType> -::Update(void) -{ - this->PrepareIHM(); - -/* this->Superclass::Update(); - glSliceView->TreatInputImage(); - glSliceView->update();*/ - this->Superclass::Update(); - static bool firstTime = true; - iviewWindow->show(); - glSliceView->TreatInputImage(); - glSliceView->show(); - glSliceView->update(); - if( firstTime ) - { - firstTime = false; - Fl::check(); - glSliceView->redraw(); - Fl::check(); - } - -} - -template <class TPixel, class OverlayPixelType> -void -VectorImageViewerSimple<TPixel,OverlayPixelType> -::Synchronize(void) -{ - float iwDiff = glSliceView->iwMax() - glSliceView->iwMin(); - float b = (float)((int)log10(iwDiff)-2); - double iwMin = ((int)(glSliceView->iwMin()*pow((float)10, (float)-b)))/pow((float)10,(float)-b); - double iwMax = ((int)(glSliceView->iwMax()*pow((float)10, (float)-b)))/pow((float)10,(float)-b); - double iwStep = (iwMax-iwMin)/100.0; - -} - -template <class TPixel, class OverlayPixelType> -void -VectorImageViewerSimple<TPixel,OverlayPixelType> -::PrepareIHM(void) -{ - int SizeX = glSliceView->GetInput()->GetLargestPossibleRegion().GetSize()[0]; - int SizeY = glSliceView->GetInput()->GetLargestPossibleRegion().GetSize()[1]; - iviewWindow->size(SizeX, SizeY); - -} - -template <class TPixel, class OverlayPixelType> -void -VectorImageViewerSimple<TPixel,OverlayPixelType> -::SetLabel(const char * label) -{ - iviewWindow->label( label ); -} - -template <class TPixel, class OverlayPixelType> -void -VectorImageViewerSimple<TPixel,OverlayPixelType> -::CreateGLSliceView( Fl_Group * group, Fl_Gl_Window * original ) -{ - - short int x = original->x(); - short int y = original->y(); - short int w = original->w(); - short int h = original->h(); - - const char * label = original->label(); - - -// this->glSliceView = new GLImageViewType(x,y,w,h,label); - this->glSliceView = GLVectorImageViewType::New(); - this->glSliceView->Init(x,y,w,h,label); - this->glSliceView->box( FL_EMBOSSED_BOX ); -// THOMAS : comme l'image est invers??e par d??faut, on a remet a l'endroit -// this->glSliceView->flipY(true); - - group->remove( original ); - - delete original; - - -} - - -template <class TPixel, class OverlayPixelType> -void -VectorImageViewerSimple<TPixel,OverlayPixelType> -::ClickSelectCallBack( void (*newClickSelectArgCallBack)(float, float, - float, float, - void *), - void * newClickSelectArg) -{ - glSliceView->clickSelectCallBack( newClickSelectArgCallBack, - newClickSelectArg ); -} - - - -} // end namespace otb -#endif -