From: Eduardo DAVILA Date: Fri, 11 Feb 2022 16:37:08 +0000 (-0300) Subject: #3482 Bug Manual Paint - MacOs and UChar images X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=f0c932f9239ca6896362134715d9aa8fcb2c145a;p=creaMaracasVisu.git #3482 Bug Manual Paint - MacOs and UChar images --- diff --git a/bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx b/bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx index be8c85c..2939ed3 100644 --- a/bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx +++ b/bbtk/src/bbcreaMaracasVisuManualPaint_Model.cxx @@ -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 index 0000000..690e03e --- /dev/null +++ b/bbtk/src/bbcreaMaracasVisuManualPaint_Model_paint.cxx @@ -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 = " <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 index 0000000..26648c5 --- /dev/null +++ b/bbtk/src/bbcreaMaracasVisuManualPaint_Model_paint.h @@ -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 + +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); + // 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,""); +//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__ + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.cxx index a9bc413..ab00161 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.cxx @@ -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"); + } // ---------------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx index 109b1f2..a4cdf59 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx @@ -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; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.cxx index d8a7dc0..97b76ea 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.cxx @@ -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"); } // ---------------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx index cba183c..0d650a7 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx @@ -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++ )