]> Creatis software - creaMaracasVisu.git/commitdiff
#3482 Bug Manual Paint - MacOs and UChar images
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 11 Feb 2022 16:37:08 +0000 (13:37 -0300)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 11 Feb 2022 16:37:08 +0000 (13:37 -0300)
bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx
bbtk/src/bbcreaMaracasVisuManualPaint_Model_paint.cxx [new file with mode: 0644]
bbtk/src/bbcreaMaracasVisuManualPaint_Model_paint.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.cxx
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

index be8c85ca6c337cf0e7d302963ad1aa42f45f856a..2939ed3a35b93dc5af37585bc516759bc6e56a3c 100644 (file)
@@ -144,7 +144,9 @@ void ManualPaint_Model::Process()
         hay que crear una imagen2 temporal y luego bajar la imagen 
 3. Verificar el mecanismo de undo con ByLstPoints
 4. Verificar el mecanismo de undo con ByImagePoints
-*/ 
+*/
+    
+    printf("EED ManualPaint_Model::Process Start \n");
        if (bbGetInputActive()==true)
        {
                if (bbGetInputImage()!=NULL)
@@ -380,6 +382,9 @@ omp_set_num_threads( omp_get_max_threads()-1 );
                bbSetOutputOut( NULL );
        } 
        bbSetOutputManualpaintmodel( manualpaintmodel );
+    
+    printf("EED ManualPaint_Model::Process End \n");
+
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
diff --git a/bbtk/src/bbcreaMaracasVisuManualPaint_Model_paint.cxx b/bbtk/src/bbcreaMaracasVisuManualPaint_Model_paint.cxx
new file mode 100644 (file)
index 0000000..690e03e
--- /dev/null
@@ -0,0 +1,84 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#include "bbcreaMaracasVisuManualPaint_Model_paint.h"
+#include "bbcreaMaracasVisuPackage.h"
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint_Model_paint)
+BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_Model_paint,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void ManualPaint_Model_paint::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+//    bbSetOutputOut( bbGetInputIn() );
+//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+  
+    printf("EED ManualPaint_Model_paint::Process Start \n");
+    if (bbGetInputActive()==true)
+    {
+        ManualPaintModel *manualpaintmodel=bbGetInputManualPaintModel();
+        if ((bbGetInputPoint().size()==3) && (manualpaintmodel!=NULL) )
+        {
+            manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
+            manualpaintmodel->SetUndoImage();
+            manualpaintmodel->Copy_GeneralAuxFill_to_Results();
+        } // if Points
+    } // if Active
+    printf("EED ManualPaint_Model_paint::Process End\n");
+
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void ManualPaint_Model_paint::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+    bbSetInputActive(true);
+    bbSetInputManualPaintModel(NULL);
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void ManualPaint_Model_paint::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+
+  
+}
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+void ManualPaint_Model_paint::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+
diff --git a/bbtk/src/bbcreaMaracasVisuManualPaint_Model_paint.h b/bbtk/src/bbcreaMaracasVisuManualPaint_Model_paint.h
new file mode 100644 (file)
index 0000000..26648c5
--- /dev/null
@@ -0,0 +1,52 @@
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+#ifndef __bbcreaMaracasVisuManualPaint_Model_paint_h_INCLUDED__
+#define __bbcreaMaracasVisuManualPaint_Model_paint_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include <ManualPaintModel.h>
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT ManualPaint_Model_paint
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(ManualPaint_Model_paint,bbtk::AtomicBlackBox);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+    BBTK_DECLARE_INPUT(Active,bool);
+    BBTK_DECLARE_INPUT(ManualPaintModel,ManualPaintModel*);
+      BBTK_DECLARE_INPUT(Point,std::vector<int>);
+  //  BBTK_DECLARE_OUTPUT(Out,double);
+    BBTK_PROCESS(Process);
+    void Process();
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(ManualPaint_Model_paint,bbtk::AtomicBlackBox);
+  BBTK_NAME("ManualPaint_Model_paint");
+  BBTK_AUTHOR("InfoDev");
+  BBTK_DESCRIPTION("No Description.");
+  BBTK_CATEGORY("empty");
+  BBTK_INPUT(ManualPaint_Model_paint,Active,"(default true) Active",bool,"");
+  BBTK_INPUT(ManualPaint_Model_paint,ManualPaintModel,"ManualPaintModel",ManualPaintModel*,"");
+  BBTK_INPUT(ManualPaint_Model_paint,Point,"[x,y,z]",std::vector<int>,"");
+//BBTK_OUTPUT(ManualPaint_Model-paint,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ManualPaint_Model_paint);
+//===== 
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//===== 
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuManualPaint_Model_paint_h_INCLUDED__
+
index a9bc413c4316e51546da57dc58c730845cd2238a..ab00161f83ef3fb59d4ac2fda4e883e5fffd0cf6 100755 (executable)
@@ -47,12 +47,19 @@ Image3DDequeUR::Image3DDequeUR( )
 #ifdef _WIN32
        this->m_GlobalPath = std::getenv("TEMP");
 #endif
+    
 #ifdef _WIN64
        this->m_GlobalPath = std::getenv("TEMP");
 #endif
+    
 #ifdef LINUX
        this->m_GlobalPath = "/tmp/";
-#endif // MACOSX
+#endif
+    
+#ifdef MACOSX
+    this->m_GlobalPath = "/tmp/";
+#endif
+    
        this->m_CurrentURPos = -1;
 }
 
@@ -118,6 +125,7 @@ ImageInfoUR* Image3DDequeUR::Redo( )
 //virtual
 void Image3DDequeUR::CleanURContainerFromIndex( const int& index )
 {
+    printf("EED Image3DDequeUR::CleanURContainerFromIndex Start \n");
        int count = 0;
        for( unsigned int i = index; i < this->m_ImgURDeque.size( ); i++ )
        {
@@ -129,6 +137,8 @@ void Image3DDequeUR::CleanURContainerFromIndex( const int& index )
        {
                this->m_ImgURDeque.pop_back( );
        } //rof
+    printf("EED Image3DDequeUR::CleanURContainerFromIndex End \n");
+
 }
 
 // ----------------------------------------------------------------------------------
index 109b1f2d228810244b685d34ac57ff202edca009..a4cdf591d26bbd69fcedc6597d52c51839250996 100755 (executable)
@@ -151,6 +151,7 @@ void ImageInfoUR::RemoveImagesFromMemory(const StringType& gPath)
 {
        if (!this->m_OnDisk) 
        {
+        printf("EED ImageInfoUR::RemoveImagesFromMemory  >>>>  %s \n", gPath.c_str() );
                this->SaveImagesOnDisk(gPath);
        }
        this->m_UndoImage = NULL;
index d8a7dc01551136027bb897384b85b99cf9f7bca4..97b76eab0427e33df4b2042611758f8d0523831d 100644 (file)
@@ -72,7 +72,9 @@ void ImageMManager::CleanModifiedRegion()
 // ----------------------------------------------------------------------------------
 void ImageMManager::CalculateMinMaxRegion(const int& i, const int& j, const int& k) 
 {
-       if (i >= 0 && j >= 0 && k >= 0) 
+    printf("EED ImageMManager::CalculateMinMaxRegion i j k =  %d %d %d\n", i, j, k);
+    printf("EED ImageMManager::CalculateMinMaxRegion min  =  %d %d %d\n", this->m_RegionStruct.minX, this->m_RegionStruct.minY, this->m_RegionStruct.minZ);
+       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)  { this->m_RegionStruct.maxX = i; } //esle
@@ -85,8 +87,8 @@ void ImageMManager::CalculateMinMaxRegion(const int& i, const int& j, const int&
                this->m_ValidRegion = false;
        } // if i j k
 
-//     if (m_ValidRegion )  printf("  ImageMManager::CalculateMinMaxRegion true \n");
-//     if (!m_ValidRegion ) printf("  ImageMManager::CalculateMinMaxRegion false \n");
+       if (m_ValidRegion )  printf("EED  ImageMManager::CalculateMinMaxRegion true \n");
+       if (!m_ValidRegion ) printf("EED   ImageMManager::CalculateMinMaxRegion false \n");
 }
 
 // ----------------------------------------------------------------------------------
index cba183cac36e253477109ac70bcdc0734dc50be8..0d650a7df91ac84f465cedb3c855ef2d8182f0e2 100755 (executable)
@@ -86,9 +86,9 @@ void ImageUndoRedo::SetImage( VTKImageDataPointerType image )
 void ImageUndoRedo::SetURImages( ImageMManagerType* imMManager )
 {
        ImageMManagerType* newImageManager = new ImageMManagerType( imMManager );
-       if( newImageManager->ValidateRegion( ) )
+       if( newImageManager->ValidateRegion() )
        {
-               RegionSType region = newImageManager->GetModifiedRegion( );
+               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 );
@@ -164,7 +164,9 @@ void ImageUndoRedo::DrawUR( ImageInfoUR* imageInfo, const bool& undo )
        {
                int *dim                        = img->GetDimensions( );        
                int sizeXImageIn        = dim[ 0 ];
-               size_t linesize         = sizeXImageIn * sizeof(unsigned short);
+//EED         size_t linesize     = sizeXImageIn * sizeof(unsigned short);
+        
+        size_t linesize     = sizeXImageIn * img->GetScalarSize();
                for( int j = region.minY, y = 0; j <= region.maxY; j++, y++ )
                {
                        for( int k = region.minZ, z = 0; k <= region.maxZ; k++, z++ )