]> Creatis software - creaMaracasVisu.git/commitdiff
#3331 creaMaracasVisu Bug New Normal - Select contour with 2 points, HelpViewerNV
authorEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Thu, 2 Jan 2020 14:59:55 +0000 (15:59 +0100)
committerEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Thu, 2 Jan 2020 14:59:55 +0000 (15:59 +0100)
14 files changed:
bbtk/bbs/boxes/HelpViewerNV.bbg [new file with mode: 0644]
bbtk/bbs/boxes/HelpViewerNV.bbs [new file with mode: 0644]
bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx
bbtk/src/bbcreaMaracasVisuManualContourModel_Box.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintModel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/vtkInteractorManualPaint.cpp

diff --git a/bbtk/bbs/boxes/HelpViewerNV.bbg b/bbtk/bbs/boxes/HelpViewerNV.bbg
new file mode 100644 (file)
index 0000000..ba6319a
--- /dev/null
@@ -0,0 +1,129 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /home/davila/Creatis/C8/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/HelpViewerNV.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:TRUE
+COMPLEXBOXNAME:HelpViewerNV
+PACKAGENAME:creaMaracasVisu
+COMPLEXOUTPUTS:1
+COMPLEX_PORT
+widget
+-35.421851:-72.510817:-900.000000
+FIN_COMPLEX_PORT
+COMPLEXINPUTS:0
+BOXES:10
+BOX
+wx:LayoutLine:Box02
+ISEXEC:TRUE
+-38.719592:-37.691851:-900.000000
+18.840408:-47.691851:-900.000000
+FIN_BOX
+BOX
+wx:OutputText:Box03
+ISEXEC:FALSE
+-84.617474:82.369571:-900.000000
+-47.842474:72.369571:-900.000000
+PORT
+In:"-Change Z&&2P&& Drag right click mouse"
+FIN_BOX
+BOX
+wx:OutputText:Box04
+ISEXEC:FALSE
+-59.479411:68.651033:-900.000000
+-22.704411:58.651033:-900.000000
+PORT
+In:"-Zoom&&2P&& Drag ctrl-right click mouse"
+FIN_BOX
+BOX
+wx:OutputText:Box05
+ISEXEC:FALSE
+-28.972162:52.915716:-900.000000
+7.802838:42.915716:-900.000000
+PORT
+In:"-Zoom&&2P&& Wheel mouse"
+FIN_BOX
+BOX
+wx:OutputText:Box06
+ISEXEC:FALSE
+-4.155228:38.876049:-900.000000
+32.619772:28.876049:-900.000000
+PORT
+In:"-Move image&&2P&& Drag shift-left click mouse"
+FIN_BOX
+BOX
+wx:OutputText:Box07
+ISEXEC:FALSE
+15.343630:19.839436:-900.000000
+52.118630:9.839436:-900.000000
+PORT
+In:"-Rotate image&&2P&& Drag ctrl-middle click mouse"
+FIN_BOX
+BOX
+wx:OutputText:Box08
+ISEXEC:FALSE
+40.481693:6.120898:-900.000000
+77.256693:-3.879102:-900.000000
+PORT
+In:"-Picker (position, gray level)&&2P&& Mouse move"
+FIN_BOX
+BOX
+wx:OutputText:Box09
+ISEXEC:FALSE
+70.988942:-9.614420:-900.000000
+107.763942:-19.614420:-900.000000
+PORT
+In:"-Move axes&&2P&& Drag the axes with click mouse left"
+FIN_BOX
+BOX
+wx:OutputText:Box10
+ISEXEC:FALSE
+95.805876:-23.654087:-900.000000
+132.580876:-33.654087:-900.000000
+PORT
+In:"-Choose a point&&2P&& Double click "
+FIN_BOX
+BOX
+wx:OutputText:Box11
+ISEXEC:FALSE
+-103.204056:98.464914:-900.000000
+-66.429056:88.464914:-900.000000
+PORT
+In:"-Brightness / Contrast&&2P&& Drag middle click mouse "
+FIN_BOX
+CONNECTIONS:10
+CONNECTION
+Box11:Widget:Box02:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box03:Widget:Box02:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box04:Widget:Box02:Widget3
+NumberOfControlPoints:0
+CONNECTION
+Box05:Widget:Box02:Widget4
+NumberOfControlPoints:0
+CONNECTION
+Box06:Widget:Box02:Widget5
+NumberOfControlPoints:0
+CONNECTION
+Box07:Widget:Box02:Widget6
+NumberOfControlPoints:0
+CONNECTION
+Box08:Widget:Box02:Widget7
+NumberOfControlPoints:0
+CONNECTION
+Box09:Widget:Box02:Widget8
+NumberOfControlPoints:0
+CONNECTION
+Box10:Widget:Box02:Widget9
+NumberOfControlPoints:0
+CONNECTION
+Box02:Widget:widget:widget
+NumberOfControlPoints:0
+APP_END
diff --git a/bbtk/bbs/boxes/HelpViewerNV.bbs b/bbtk/bbs/boxes/HelpViewerNV.bbs
new file mode 100644 (file)
index 0000000..e260f59
--- /dev/null
@@ -0,0 +1,64 @@
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
+# - /home/davila/Creatis/C8/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/HelpViewerNV.bbs
+# ----------------------------------
+
+include std
+include itkvtk
+include wx
+
+define HelpViewerNV creaMaracasVisu
+
+author "Author ??"
+description "Description ??"
+
+category "<VOID>"
+
+new wx:LayoutLine Box02
+
+new wx:OutputText Box03
+  set Box03.In "-Change Z: Drag right click mouse"
+
+new wx:OutputText Box04
+  set Box04.In "-Zoom: Drag ctrl-right click mouse"
+
+new wx:OutputText Box05
+  set Box05.In "-Zoom: Wheel mouse"
+
+new wx:OutputText Box06
+  set Box06.In "-Move image: Drag shift-left click mouse"
+
+new wx:OutputText Box07
+  set Box07.In "-Rotate image: Drag ctrl-middle click mouse"
+
+new wx:OutputText Box08
+  set Box08.In "-Picker (position, gray level): Mouse move"
+
+new wx:OutputText Box09
+  set Box09.In "-Move axes: Drag the axes with click mouse left"
+
+new wx:OutputText Box10
+  set Box10.In "-Choose a point: Double click "
+
+new wx:OutputText Box11
+  set Box11.In "-Brightness / Contrast: Drag middle click mouse "
+
+
+connect Box11.Widget Box02.Widget1
+connect Box03.Widget Box02.Widget2
+connect Box04.Widget Box02.Widget3
+connect Box05.Widget Box02.Widget4
+connect Box06.Widget Box02.Widget5
+connect Box07.Widget Box02.Widget6
+connect Box08.Widget Box02.Widget7
+connect Box09.Widget Box02.Widget8
+connect Box10.Widget Box02.Widget9
+
+# Complex input ports
+
+# Complex output ports
+output widget Box02.Widget " "
+
+exec Box02
+
+endefine
index 9a20b5f9946f5446ed7decb03e0cee07424f6f44..8ad078e6d20b6ae2669f8a5a6975edc9ae60e0da 100644 (file)
@@ -137,6 +137,107 @@ void ManualContourModel_Box::RedistributionPoints(        std::vector<double> *lstOutX,
 }
 
 
+void ManualContourModel_Box::ClockwisePoints(  std::vector<double> *lstInX,
+                                                                                       std::vector<double> *lstInY, 
+                                                                                       std::vector<double> *lstInZ,
+                                                                                       std::vector<int> *lstIndexsIn )
+{
+       int     iLstIndexIn,sizeLstIndexIn=lstIndexsIn->size();
+       int     i,iGeneral=0;
+       int     size,size2;
+       double  cx,cy,cz;
+       double  px,py,pz;
+       double  backpx,backpy,backpz;
+       double  ang;
+       char    dir=-1;
+       bool    dirx,diry,dirz;
+       int     flagAng=0;
+       float   backang;
+       double  tmp;
+
+       // For each contour
+       for (iLstIndexIn=0;  iLstIndexIn<sizeLstIndexIn; iLstIndexIn++)
+       {
+               // Step 1. Find gravity center and direction
+               size    = (*lstIndexsIn)[iLstIndexIn];
+               if (size>2)  // for contour with more than 2 points
+               {
+                       cx              = 0;
+                       cy              = 0;
+                       cz              = 0;
+                       dirx    = true;
+                       diry    = true;
+                       dirz    = true;
+                       for ( i=0 ; i<size ; i++ )
+                       {
+                               px=(*lstInX)[iGeneral+i];
+                               py=(*lstInY)[iGeneral+i];
+                               pz=(*lstInZ)[iGeneral+i];
+                               cx      = px + cx;
+                               cy      = py + cy;
+                               cz      = pz + cz;
+                               if (i!=0) 
+                               { 
+                                       if (backpx!=px) { dirx=false; } 
+                                       if (backpy!=py) { diry=false; } 
+                                       if (backpz!=pz) { dirz=false; } 
+                                       backpx=px;
+                                       backpy=py;
+                                       backpz=pz;
+                               } // if i!=0
+                               backpx=px; 
+                               backpy=py; 
+                               backpz=pz; 
+                       } // for i 
+                       cx=cx/size;
+                       cy=cy/size;
+                       cz=cz/size;
+                       if (dirx==true) { dir=1; }  // YZ 
+                       if (diry==true) { dir=2; }  // XZ 
+                       if (dirz==true) { dir=0; }  // XZ 
+                       // Step 2. Find angle diference find 
+                       flagAng=0;
+                       for ( i=0 ; i<size ; i++ )
+                       {
+                               px = (*lstInX)[iGeneral+i]-cx;
+                               py = (*lstInY)[iGeneral+i]-cy;
+                               pz = (*lstInZ)[iGeneral+i]-cz;
+                               if (dir==0) { ang=atan2( py , px ); } // XY
+                               if (dir==1) { ang=atan2( pz , py ); } // YZ
+                               if (dir==2) { ang=atan2( pz , px ); } // XZ
+                               if (i>0) 
+                               { 
+                                       if (backang<ang) 
+                                       {
+                                               flagAng++;
+                                       } else {
+                                               flagAng--;
+                                       }// if backang<ang
+                               } // if i
+                               backang=ang; 
+                       } // for i 
+
+                       // Step 3. Invert order of points
+                       if (flagAng<0)
+                       {
+                               size2 = size/2;
+                               for ( i=0 ; i<size2 ; i++ )
+                               {
+                                       tmp                                                     = (*lstInX)[iGeneral+i];
+                                       (*lstInX)[iGeneral+i]                   = (*lstInX)[iGeneral+size-1-i];
+                                       (*lstInX)[iGeneral+size-1-i]    = tmp;
+                                       tmp                                                     = (*lstInY)[iGeneral+i];
+                                       (*lstInY)[iGeneral+i]                   = (*lstInY)[iGeneral+size-1-i];
+                                       (*lstInY)[iGeneral+size-1-i]    = tmp;
+                                       tmp                                                     = (*lstInZ)[iGeneral+i];
+                                       (*lstInZ)[iGeneral+i]                   = (*lstInZ)[iGeneral+size-1-i];
+                                       (*lstInZ)[iGeneral+size-1-i]    = tmp;
+                               } // for i
+                       } // flagAng
+               } // size>2
+               iGeneral = iGeneral+size;
+       } // for iLstIndexIn
+}
 
 void ManualContourModel_Box::ShiftValues(      std::vector<double> *lstInX,
                                                                                        std::vector<double> *lstInY, 
@@ -236,6 +337,7 @@ void ManualContourModel_Box::Process()
        }
        if (bbGetInputDoubleContour()==1)
        {
+               ClockwisePoints( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
                ShiftValues( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
        } // DoubleContour
        int i,size=lstIndexsIn.size();
index 651eb3dd09740aec4dad99b6527bed78601d339b..760f2b0c89f842d61cb3a0e63891e51254a6fb56 100644 (file)
@@ -39,6 +39,11 @@ class bbcreaMaracasVisu_EXPORT ManualContourModel_Box
   void Process();
 
 
+void ClockwisePoints(  std::vector<double> *lstInX,
+                                       std::vector<double> *lstInY, 
+                                       std::vector<double> *lstOuZ,
+                                       std::vector<int> *lstIndexsIn );
+
 void ShiftValues(      std::vector<double> *lstInX,
                                        std::vector<double> *lstInY, 
                                        std::vector<double> *lstOuZ,
index 3e39e532942506600d6d26e3760dddad875f0881..fd668577e9ced6496832e80f23bc2e5e1f2738af 100755 (executable)
 #include "imageInfoUR.h"
 
 // ----------------------------------------------------------------------------------
-ImageInfoUR::ImageInfoUR() {
+ImageInfoUR::ImageInfoUR() 
+{
        this->m_OnMemory = false;
        this->m_OnDisk = false;
 }
 // ----------------------------------------------------------------------------------
-ImageInfoUR::~ImageInfoUR() {
+ImageInfoUR::~ImageInfoUR() 
+{
 }
 // ----------------------------------------------------------------------------------
-void ImageInfoUR::SetImageName(const StringType &imgName) {
+void ImageInfoUR::SetImageName(const StringType &imgName) 
+{
        this->m_ImageName = imgName;
 }
 // ----------------------------------------------------------------------------------
-void ImageInfoUR::SetImageMManager(ImageMManagerType* imMManager) {
+void ImageInfoUR::SetImageMManager(ImageMManagerType* imMManager) 
+{
        this->m_ImageMManager = imMManager;
 }
 // ----------------------------------------------------------------------------------
-void ImageInfoUR::SetStatus(const bool& onMemory) {
+void ImageInfoUR::SetStatus(const bool& onMemory) 
+{
        this->m_OnMemory = onMemory;
 }
 // ----------------------------------------------------------------------------------
-ImageInfoUR::StringType ImageInfoUR::GetImageName() {
+ImageInfoUR::StringType ImageInfoUR::GetImageName() 
+{
        return (this->m_ImageName);
 }
 // ----------------------------------------------------------------------------------
-ImageInfoUR::VTKImageDataPointerType ImageInfoUR::GetUndoImage() {
+ImageInfoUR::VTKImageDataPointerType ImageInfoUR::GetUndoImage() 
+{
        return (this->m_UndoImage);
 }
 // ----------------------------------------------------------------------------------
-ImageInfoUR::VTKImageDataPointerType ImageInfoUR::GetRedoImage() {
+ImageInfoUR::VTKImageDataPointerType ImageInfoUR::GetRedoImage() 
+{
        return (this->m_RedoImage);
 }
 // ----------------------------------------------------------------------------------
-ImageInfoUR::ImageMManagerType* ImageInfoUR::GetImageMManager() {
+ImageInfoUR::ImageMManagerType* ImageInfoUR::GetImageMManager() 
+{
        return (this->m_ImageMManager);
 }
 // ----------------------------------------------------------------------------------
-bool ImageInfoUR::GetStatus() {
+bool ImageInfoUR::GetStatus() 
+{
        return (this->m_OnMemory);
 }
 // ----------------------------------------------------------------------------------
-void ImageInfoUR::SetImages(VTKImageDataPointerType imgUndo,
-               VTKImageDataPointerType imgRedo) {
+void ImageInfoUR::SetImages(VTKImageDataPointerType imgUndo, VTKImageDataPointerType imgRedo) 
+{
        this->m_UndoImage = imgUndo;
        this->m_RedoImage = imgRedo;
        this->SetStatus(true);
 }
 // ----------------------------------------------------------------------------------
-void ImageInfoUR::LoadImagesToMemory(const StringType& gPath) {
+void ImageInfoUR::LoadImagesToMemory(const StringType& gPath) 
+{
        //setting paths
        StringType filename = gPath + this->m_ImageName;
        StringType undoImagePath = filename + "_Undo.mhd";
        StringType redoImagePath = filename + "_Redo.mhd";
        //Loading Undo Image
-       VTKMetaImageReaderPointerType readerUndo =
-                       VTKMetaImageReaderPointerType::New();
+       VTKMetaImageReaderPointerType readerUndo = VTKMetaImageReaderPointerType::New();
        readerUndo->SetFileName(undoImagePath.c_str());
        this->m_UndoImage = readerUndo->GetOutput();
 //EED 2017-01-01 Migration VTK7
@@ -98,8 +108,7 @@ void ImageInfoUR::LoadImagesToMemory(const StringType& gPath) {
        // ..
 #endif
        //Loading Redo Image
-       VTKMetaImageReaderPointerType readerRedo =
-                       VTKMetaImageReaderPointerType::New();
+       VTKMetaImageReaderPointerType readerRedo = VTKMetaImageReaderPointerType::New();
        readerRedo->SetFileName(redoImagePath.c_str());
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
@@ -119,8 +128,10 @@ void ImageInfoUR::LoadImagesToMemory(const StringType& gPath) {
        this->m_OnMemory = true;
 }
 // ----------------------------------------------------------------------------------
-void ImageInfoUR::RemoveImagesFromMemory(const StringType& gPath) {
-       if (!this->m_OnDisk) {
+void ImageInfoUR::RemoveImagesFromMemory(const StringType& gPath) 
+{
+       if (!this->m_OnDisk) 
+       {
                this->SaveImagesOnDisk(gPath);
        }
        this->m_UndoImage = NULL;
@@ -128,16 +139,20 @@ void ImageInfoUR::RemoveImagesFromMemory(const StringType& gPath) {
        this->SetStatus(false);
 }
 // ----------------------------------------------------------------------------------
-void ImageInfoUR::SaveImagesOnDisk(const StringType& gPath) {
+void ImageInfoUR::SaveImagesOnDisk(const StringType& gPath) 
+{
+       printf("EED ImageInfoUR::SaveImagesOnDisk Start  \n");
        this->m_OnDisk = true;
        StringType filename = gPath + this->m_ImageName;
        StringType undoImagePath = filename + "_Undo.mhd";
        StringType redoImagePath = filename + "_Redo.mhd";
        this->SaveImageAsMHD(undoImagePath, this->m_UndoImage);
        this->SaveImageAsMHD(redoImagePath, this->m_RedoImage);
+       printf("EED ImageInfoUR::SaveImagesOnDisk %s \n", undoImagePath.c_str() );
 }
 // ----------------------------------------------------------------------------------
-void ImageInfoUR::RemoveImagesFromDisk(const StringType& gPath) {
+void ImageInfoUR::RemoveImagesFromDisk(const StringType& gPath) 
+{
        StringType filename = gPath + this->m_ImageName;
        StringType undoImagePathMHD = filename + "_Undo.mhd";
        StringType redoImagePathMHD = filename + "_Redo.mhd";
@@ -149,8 +164,8 @@ void ImageInfoUR::RemoveImagesFromDisk(const StringType& gPath) {
        remove(redoImagePathRAW.c_str());
 }
 // ----------------------------------------------------------------------------------
-void ImageInfoUR::SaveImageAsMHD(const StringType& filename,
-               VTKImageDataPointerType image) {
+void ImageInfoUR::SaveImageAsMHD(const StringType& filename, VTKImageDataPointerType image) 
+{
        VTKMetaImageWriterPointerType w = VTKMetaImageWriterPointerType::New();
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
index d4ae5a64ed72164fec3c96aac82194716d11b638..0bdcfdef2dad273bcd8614df632ba579f26753ee 100644 (file)
 #include "imageModificationManager.h"
 
 // ----------------------------------------------------------------------------------
-ImageMManager::ImageMManager() {
-
+ImageMManager::ImageMManager() 
+{
 }
 // ----------------------------------------------------------------------------------
-ImageMManager::ImageMManager(ImageMManager* manager) {
+ImageMManager::ImageMManager(ImageMManager* manager) 
+{
        this->m_RegionStruct = manager->GetModifiedRegion();
 }
 // ----------------------------------------------------------------------------------
-ImageMManager::~ImageMManager() {
-
+ImageMManager::~ImageMManager() 
+{
 }
 // ----------------------------------------------------------------------------------
-void ImageMManager::CleanModifiedRegion() {
-
+void ImageMManager::CleanModifiedRegion() 
+{
        int min = std::numeric_limits<int>::min();
        int max = std::numeric_limits<int>::max();
        this->m_RegionStruct.minX = max;
@@ -59,43 +60,57 @@ void ImageMManager::CleanModifiedRegion() {
        this->m_ValidRegion = false;
 }
 // ----------------------------------------------------------------------------------
-void ImageMManager::CalculateMinMaxRegion(const int& i, const int& j,
-               const int& k) {
-       if (i >= 0 && j >= 0 && k >= 0) {
-               if (i <= this->m_RegionStruct.minX) {
+void ImageMManager::CalculateMinMaxRegion(const int& i, const int& j, const int& k) 
+{
+       if (i >= 0 && j >= 0 && k >= 0) 
+       {
+               if (i <= this->m_RegionStruct.minX) 
+               {
                        this->m_RegionStruct.minX = i;
                } //fi
-               if (i > this->m_RegionStruct.maxX) {
+               if (i > this->m_RegionStruct.maxX) 
+               {
                        this->m_RegionStruct.maxX = i;
                } //esle
-               if (j <= this->m_RegionStruct.minY) {
+               if (j <= this->m_RegionStruct.minY) 
+               {
                        this->m_RegionStruct.minY = j;
                } //fi
-               if (j > this->m_RegionStruct.maxY) {
+               if (j > this->m_RegionStruct.maxY) 
+               {
                        this->m_RegionStruct.maxY = j;
                } //esle
-               if (k <= this->m_RegionStruct.minZ) {
+               if (k <= this->m_RegionStruct.minZ) 
+               {
                        this->m_RegionStruct.minZ = k;
                } //fi
-               if (k > this->m_RegionStruct.maxZ) {
+               if (k > this->m_RegionStruct.maxZ) 
+               {
                        this->m_RegionStruct.maxZ = k;
                } //esle
                this->m_ValidRegion = true;
-       } //fi
-       else {
+       }else {
                this->m_ValidRegion = false;
-       } //esle
+       } // if i j k
+
+       if (m_ValidRegion )  printf("  ImageMManager::CalculateMinMaxRegion true \n");
+       if (!m_ValidRegion ) printf("  ImageMManager::CalculateMinMaxRegion false \n");
 }
+
 // ----------------------------------------------------------------------------------
-void ImageMManager::AddModifiedPixel(const int& i, const int& j, const int& k) {
+void ImageMManager::AddModifiedPixel(const int& i, const int& j, const int& k) 
+{
+printf("EED ImageMManager::AddModifiedPixel \n");
        this->CalculateMinMaxRegion(i, j, k);
 }
 // ----------------------------------------------------------------------------------
-bool ImageMManager::ValidateRegion() {
+bool ImageMManager::ValidateRegion() 
+{
        return (m_ValidRegion);
 }
 // ----------------------------------------------------------------------------------
-RegionStructUR ImageMManager::GetModifiedRegion() {
+RegionStructUR ImageMManager::GetModifiedRegion() 
+{
        return (this->m_RegionStruct);
 }
 // ----------------------------------------------------------------------------------
index 4e981c4e89e18d2bb35d4e7efd1be201636324db..698ac4fceee910a9f1e3f8abb7e4961f0589368c 100755 (executable)
@@ -88,16 +88,11 @@ void ImageUndoRedo::SetURImages( ImageMManagerType* imMManager )
        if( newImageManager->ValidateRegion( ) )
        {
                RegionSType region = newImageManager->GetModifiedRegion( );
-               VTKImageDataPointerType imgUndo = this->GetImageRegion( region,
-                       this->m_UndoImage );
-               VTKImageDataPointerType imgRedo = this->GetImageRegion( region,
-                       this->m_CurrentImage );
-               this->m_ImagesDeque->AddImagesToURContainer( imgUndo, imgRedo,
-                       newImageManager );
+               VTKImageDataPointerType imgUndo = this->GetImageRegion( region,this->m_UndoImage );
+               VTKImageDataPointerType imgRedo = this->GetImageRegion( region,this->m_CurrentImage );
+               this->m_ImagesDeque->AddImagesToURContainer( imgUndo, imgRedo,newImageManager );
                this->UpdateUndoImage( );
-       }
-       else
-       {
+       } else {
                std::cerr << "INVALID REGION" << std::endl;
        }
 }
@@ -157,9 +152,7 @@ void ImageUndoRedo::DrawUR( ImageInfoUR* imageInfo, const bool& undo )
        if( undo )
        {
                img = imageInfo->GetUndoImage( );
-       } //fi
-       else
-       {
+       } else {
                img = imageInfo->GetRedoImage( );
        } //else
        RegionSType region = imageInfo->GetImageMManager( )->GetModifiedRegion( );
@@ -173,13 +166,12 @@ void ImageUndoRedo::DrawUR( ImageInfoUR* imageInfo, const bool& undo )
                        for( int k = region.minZ, z = 0; k <= region.maxZ; k++, z++ )
                        {
                                void* ptrsrc = img->GetScalarPointer( 0, y, z );
-                               void* ptrdest = this->m_CurrentImage->GetScalarPointer(
-                                       region.minX, j, k );
+                               void* ptrdest = this->m_CurrentImage->GetScalarPointer( region.minX, j, k );
                                memcpy( ptrdest, ptrsrc, linesize );
-                       }
-               }
+                       } // for k
+               } // for j
                this->m_CurrentImage->Modified( );
-       }
+       } // if img
        this->m_ImagesDeque->ManageMemory( );
 }
 // ----------------------------------------------------------------------------------
index 4493ed5b38b09612af60f56d5f76b6b4eb8efc6b..e94a2b7022ec0252e44013fccadff9ffcdc16475 100644 (file)
@@ -71,8 +71,8 @@ public:
 
        virtual manualContourModel * Clone();
        void CopyAttributesTo( manualContourModel *cloneObject );
-       void Open(FILE *ff);    // virtual
-       virtual void Save(FILE *ff);    // virtual
+       void Open(FILE *ff);                            // virtual
+       virtual void Save(FILE *ff);            // virtual
        virtual int GetTypeModel();                     // virtual 
 
        virtual int                             AddPoint(double x,double y,double z);
index e279664f794d5b9b7fe8e2b620069c30d9b0593a..50754a1c391b1438be723570534c80ae8fc96843 100644 (file)
@@ -310,20 +310,21 @@ bool manualViewContour::ifTouchContour(int x,int y,int z)
        {  // inside the boundaring box
                if ( ShowLineVersion()==true )
                {
-                       manualPoint *mpA = _manContModel->GetManualPoint(0);
-                       manualPoint *mpB = _manContModel->GetManualPoint(1);
                        _pts->GetPoint(0, ppA);
+                       _pts->GetPoint(1, ppB);
                        double dirVec[3];
                        // direction of the segment
-            dirVec[0] = mpB->GetX() - mpA->GetX();                     
-            dirVec[1] = mpB->GetY() - mpA->GetY();                     
-            dirVec[2] = mpB->GetZ() - mpA->GetZ();                     
+            dirVec[0] = ppB[0] - ppA[0];
+            dirVec[1] = ppB[1] - ppA[1];
+            dirVec[2] = ppB[2] - ppA[2];
                        // proj = mpA + k*dirVec
                        double num;
                        double den = 0.0 ;
-                       num     = dirVec[0]*( xx-mpA->GetX() );
-                       num     = num + dirVec[1]*( yy-mpA->GetY() );
-                       num     = num + dirVec[2]*( zz-mpA->GetZ() );
+
+                       num     = dirVec[0]*( xx-ppA[0] );
+                       num     = num + dirVec[1]*( yy-ppA[1] );
+                       num     = num + dirVec[2]*( zz-ppA[2] );
+
                        den=dirVec[0]*dirVec[0] + dirVec[1]*dirVec[1] + dirVec[2]*dirVec[2];
                        double k;
                        if (den!=0) 
@@ -333,9 +334,10 @@ bool manualViewContour::ifTouchContour(int x,int y,int z)
                                k = 99999999;
                        }
                        // projection of th point xx,yy,zz  in segment mpA,mpB
-                       double projX = mpA->GetX() + k*dirVec[0];
-                       double projY = mpA->GetY() + k*dirVec[1];
-                       double projZ = mpA->GetZ() + k*dirVec[2];
+                       double projX = ppA[0] + k*dirVec[0];
+                       double projY = ppA[1] + k*dirVec[1];
+                       double projZ = ppA[2] + k*dirVec[2];
+
 
                        // distance [projX,projY,projZ]   and   (xx,yy,zz]
                        double d1= sqrt(  (projX-xx)*(projX-xx) + (projY-yy)*(projY-yy) +(projZ-zz)*(projZ-zz) );
index f792652e95f4e34fa9cd218277ab2811ea6fbec6..3085a209b22683f968a0f910885bd5f6e32ab43f 100644 (file)
@@ -25,7 +25,8 @@
 
 #include "BrushFilter.h"
 
-BrushFilter::BrushFilter() {
+BrushFilter::BrushFilter() 
+{
        _brushsize = 1;
        _brushform = 0; // 0 rectangle-cube  ,   1 circle-sphere
        _brushtool = 0; // 0 pencil         ,   1 fill
@@ -38,7 +39,8 @@ BrushFilter::~BrushFilter() // virtual
 
 //---------------------------------------------------------------------------
 void BrushFilter::FindMinMaxBrush(int &minX, int &maxX, int &minY, int &maxY,
-               int &minZ, int &maxZ, int &size) {
+               int &minZ, int &maxZ, int &size) 
+{
        size = _brushsize - 1;
        minX = _px - size;
        maxX = _px + size;
index 3e35c343b3c6b924a442195b8bd85bc85b916c3c..e851dae6cd654347af33eba037786298f6ccc4ce 100644 (file)
@@ -39,13 +39,11 @@ public:
     void FindMinMaxBrush(int &minxX,int &maxX,int &minY,int &maxY,int &minZ,int &maxZ,int &size);
     virtual void Run();
 
-
 private:
     int             _brushsize;
     int             _brushform;
     int             _brushtool;
 
-
 protected:
 
 };
index 04e5b6148c94f7e0c545f64789dddce6c87e5746..476a23593d1acb04f947f234750ba3e66c18b6f2 100644 (file)
@@ -108,17 +108,12 @@ void FillFilter::Run() // virtual
                        DEF_POINTER_IMAGE_VTK_CREA_set(v_image2,ss_image2,p_image2,st_image2,_image2)           
                } // if _image2
 */
-
 //             _usingAuxImageFill                      = false;
                ivi                                             = _px + _py*(_maxX+1) + _pz*(_maxX+1)*(_maxY+1);  // index vector image
-
                FillToolLoop(_px, _py, _pz, ivi);
        } //if _minX _maxX _minY _maxY _minZ _maxZ
 }
 
-
-
-
 //---------------------------------------------------------------------------
 void FillFilter::FillToolLoop(int px, int py, int pz,long int iviA) 
 {
@@ -132,16 +127,12 @@ void FillFilter::FillToolLoop(int px, int py, int pz,long int iviA)
        lstZ.push_back(pz);
        lstivi.push_back( iviA );
 
-
        DEF_POINTER_IMAGE_VTK_CREA_set(v_image,ss_image,p_image,st_image,_image)                
        if (_image2!=NULL)
        {
                DEF_POINTER_IMAGE_VTK_CREA_set(v_image2,ss_image2,p_image2,st_image2,_image2)           
        } // if _image2
 
-
-
-
        DEF_POINTER_IMAGE_VTK_CREA(v_auxImageFill,ss_auxImageFill,p_auxImageFill,st_auxImageFill,_auxImageFill)         
        while ( lstX.size()!=0 )
        {
index feae5d5b8c3d293f5cbd829b1e35ad621f44ce46..61c234ecf81e25a35e98c59f32b5334b583c13ec 100644 (file)
@@ -155,6 +155,7 @@ void ManualPaintModel::GetScalarRange(double * range)
 //---------------------------------------------------------------------------
 void ManualPaintModel::SetUndoImage() 
 {
+       printf("EED ManualPaintModel::SetUndoImage \n");
        ImageMManager* imMManager = NULL;
        if (_tool == 0) 
        {
@@ -172,6 +173,7 @@ void ManualPaintModel::SetUndoImage()
 
 void ManualPaintModel::Undo() 
 {
+       printf("EED ManualPaintModel::Undo \n");
        this->_imageUndoRedo->Undo();
 }
 
index ae4e8b99052e791c09db49f633c8495dcdcb2dfe..f3279364f1e43cc03019a1fa4a5393a32375d214 100644 (file)
@@ -44,6 +44,7 @@ vtkInteractorManualPaint::~vtkInteractorManualPaint()
 //---------------------------------------------------------------------------
 bool vtkInteractorManualPaint::OnChar() 
 {
+printf("EED vtkInteractorManualPaint::OnChar \n");
        vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
        if (interactor->GetKeyCode() == 97) 
        {
@@ -55,8 +56,7 @@ bool vtkInteractorManualPaint::OnChar()
 //---------------------------------------------------------------------------
 bool vtkInteractorManualPaint::OnLeftButtonDown() 
 {
-       vtkRenderWindowInteractor *interactor =
-                       _vtkInteractorStyleBaseView->GetInteractor();
+       vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
        if (interactor->GetControlKey() == 1) {
                _state = true;
 //        wxVtk2DBaseView             *wxvtk2Dbaseview    = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
@@ -68,6 +68,7 @@ bool vtkInteractorManualPaint::OnLeftButtonDown()
 //---------------------------------------------------------------------------
 bool vtkInteractorManualPaint::OnLeftButtonUp() 
 {
+printf("EED vtkInteractorManualPaint::OnLeftButtonUp \n");
     if((_state == true) || (_stateKey == true))
        {
        _manualPaintControler->SetImageUndo();