From: Eduardo DAVILA Date: Thu, 2 Jan 2020 14:59:55 +0000 (+0100) Subject: #3331 creaMaracasVisu Bug New Normal - Select contour with 2 points, HelpViewerNV X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9a8f7c9cb08ffcb57f1558b9d20f7fbcd95df017;p=creaMaracasVisu.git #3331 creaMaracasVisu Bug New Normal - Select contour with 2 points, HelpViewerNV --- diff --git a/bbtk/bbs/boxes/HelpViewerNV.bbg b/bbtk/bbs/boxes/HelpViewerNV.bbg new file mode 100644 index 0000000..ba6319a --- /dev/null +++ b/bbtk/bbs/boxes/HelpViewerNV.bbg @@ -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: +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 index 0000000..e260f59 --- /dev/null +++ b/bbtk/bbs/boxes/HelpViewerNV.bbs @@ -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 "" + +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 diff --git a/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx b/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx index 9a20b5f..8ad078e 100644 --- a/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx +++ b/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.cxx @@ -137,6 +137,107 @@ void ManualContourModel_Box::RedistributionPoints( std::vector *lstOutX, } +void ManualContourModel_Box::ClockwisePoints( std::vector *lstInX, + std::vector *lstInY, + std::vector *lstInZ, + std::vector *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; iLstIndexIn2) // for contour with more than 2 points + { + cx = 0; + cy = 0; + cz = 0; + dirx = true; + diry = true; + dirz = true; + for ( i=0 ; i0) + { + if (backang2 + iGeneral = iGeneral+size; + } // for iLstIndexIn +} void ManualContourModel_Box::ShiftValues( std::vector *lstInX, std::vector *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(); diff --git a/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.h b/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.h index 651eb3d..760f2b0 100644 --- a/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.h +++ b/bbtk/src/bbcreaMaracasVisuManualContourModel_Box.h @@ -39,6 +39,11 @@ class bbcreaMaracasVisu_EXPORT ManualContourModel_Box void Process(); +void ClockwisePoints( std::vector *lstInX, + std::vector *lstInY, + std::vector *lstOuZ, + std::vector *lstIndexsIn ); + void ShiftValues( std::vector *lstInX, std::vector *lstInY, std::vector *lstOuZ, diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx index 3e39e53..fd66857 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx @@ -34,61 +34,71 @@ #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 diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.cxx index d4ae5a6..0bdcfde 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.cxx @@ -34,20 +34,21 @@ #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::min(); int max = std::numeric_limits::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); } // ---------------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx index 4e981c4..698ac4f 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx @@ -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( ); } // ---------------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h index 4493ed5..e94a2b7 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h @@ -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); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp index e279664..50754a1 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp @@ -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) ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.cpp index f792652..3085a20 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.cpp @@ -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; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.h index 3e35c34..e851dae 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/BrushFilter.h @@ -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: }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp index 04e5b61..476a235 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp @@ -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 ) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintModel.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintModel.cpp index feae5d5..61c234e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintModel.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/ManualPaintModel.cpp @@ -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(); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/vtkInteractorManualPaint.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/vtkInteractorManualPaint.cpp index ae4e8b9..f327936 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/vtkInteractorManualPaint.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/vtkInteractorManualPaint.cpp @@ -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();