]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx
commit
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkMPR3DDataViewer.cxx
index 25f66eddeb88da0fa22d32ecd32bef63ebafed70..d1806fe0c1fd7654e357d6c5d5c802a3058e0c7f 100644 (file)
@@ -1,3 +1,28 @@
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
 
 #include "vtkMPR3DDataViewer.h"
 
@@ -24,9 +49,9 @@ vtkMPR3DDataViewer::vtkMPR3DDataViewer()
 //-------------------------------------------------------------------
 vtkMPR3DDataViewer::~vtkMPR3DDataViewer()
 {
-       _outlineData-> Delete();
-       _mapOutline-> Delete();
-       _outline-> Delete();
+       if(_outlineData) {_outlineData-> Delete();}
+       if(_mapOutline)  {_mapOutline-> Delete();}
+       if(_outline)     {_outline-> Delete();}
 
 //     if (_bwLut)             _bwLut->Delete();
 //     if (_hueLut)            _hueLut->Delete();
@@ -140,19 +165,20 @@ void vtkMPR3DDataViewer::Configure()
 
 
        double range[2];
-       double max;
+       double delta;
        
-       if(_vtkmprbasedata->GetImageData()){
+       if(_vtkmprbasedata->GetImageData())
+       {
                _vtkmprbasedata->GetImageData()->GetScalarRange(range);
-               max = range[1];
+               delta = range[1]-range[0];
                
                
                _ctFunVectorPoint.clear();
-               _ctFunVectorPoint.push_back(max*0/4);
-               _ctFunVectorPoint.push_back(max*1/4);
-               _ctFunVectorPoint.push_back(max*2/4);
-               _ctFunVectorPoint.push_back(max*3/4);
-               _ctFunVectorPoint.push_back(max*4/4);
+               _ctFunVectorPoint.push_back( range[0] + delta*0/4 );
+               _ctFunVectorPoint.push_back( range[0] + delta*1/4 );
+               _ctFunVectorPoint.push_back( range[0] + delta*2/4 );
+               _ctFunVectorPoint.push_back( range[0] + delta*3/4 );
+               _ctFunVectorPoint.push_back( range[0] + delta*4/4 );
 
                _ctFunVectorRed.clear();
                _ctFunVectorRed.push_back(0.0);
@@ -176,7 +202,8 @@ void vtkMPR3DDataViewer::Configure()
                _ctFunVectorBlue.push_back(0.0);
 
 
-               if(_ctfun==NULL){
+               if(_ctfun==NULL)
+               {
                        _ctfun = vtkColorTransferFunction::New();
                }
                _ctfun->RemoveAllPoints();
@@ -319,7 +346,8 @@ vtkImageActor * vtkMPR3DDataViewer::GetvtkActor_axial()
 void vtkMPR3DDataViewer::SetPositionX(int pos){
        int x1,x2,y1,y2,z1,z2;
        _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
-       if(_saggital){
+       if(_saggital)
+       {
                _saggital->SetDisplayExtent( pos , pos , y1 ,y2 , z1 , z2 );
        }
 }
@@ -327,7 +355,8 @@ void vtkMPR3DDataViewer::SetPositionX(int pos){
 void vtkMPR3DDataViewer::SetPositionY(int pos){
        int x1,x2,y1,y2,z1,z2;
        _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
-       if(_coronal){
+       if(_coronal)
+       {
                _coronal->SetDisplayExtent(x1,x2, pos,pos, z1,z2);
        }
 }
@@ -335,7 +364,8 @@ void vtkMPR3DDataViewer::SetPositionY(int pos){
 void vtkMPR3DDataViewer::SetPositionZ(int pos){
        int x1,x2,y1,y2,z1,z2;
        _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
-       if(_axial){
+       if(_axial)
+       {
                _axial->SetDisplayExtent(x1,x2, y1,y2, pos,pos);
        }
 }
@@ -351,7 +381,8 @@ bool vtkMPR3DDataViewer::GetVisiblePosition(int idPosition)
 }
 
 void vtkMPR3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){
-       if(_saggitalColors){
+       if(_saggitalColors)
+       {
                _saggitalColors->SetLookupTable(colortable);
                _coronalColors->SetLookupTable(colortable);
                _axialColors->SetLookupTable(colortable);