FIN_COMPLEX_PORT
COMPLEX_PORT
BoxExecute_ManualPaint_Model
--167.528461:180.349965:-900.000000
+-201.995645:178.771315:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
wxvtkbaseview1
FIN_COMPLEX_PORT
COMPLEX_PORT
colorBarPosition
--192.926981:179.217332:-900.000000
+-180.034675:180.795982:-900.000000
FIN_COMPLEX_PORT
-BOXES:24
+BOXES:31
BOX
creaMaracasVisu:ManualPaint_Model:Box00
ISEXEC:FALSE
-95.174180:-58.098371:-900.000000
--49.649180:-68.098371:-900.000000
+-34.534180:-68.098371:-900.000000
PORT
2D3D:"1"
PORT
creaMaracasVisu:ColorLayerImageView:Box03
ISEXEC:FALSE
64.897021:-66.295426:-900.000000
-112.822021:-76.295426:-900.000000
+134.777021:-76.295426:-900.000000
PORT
TypeControlsInterface:"2"
PORT
BOX
wx:LayoutLine:Box09
ISEXEC:FALSE
--96.465052:-132.072726:-900.000000
--59.890052:-142.072726:-900.000000
+-100.059182:-162.443123:-900.000000
+-42.499182:-172.443123:-900.000000
FIN_BOX
BOX
std:GetVectorStringElement:Box11
BOX
wx:RadioButton:Box18
ISEXEC:FALSE
--223.537738:36.072184:-900.000000
--130.692204:26.072184:-900.000000
+-242.357156:85.809216:-900.000000
+-178.637156:75.809216:-900.000000
PORT
In:"1"
PORT
BOX
wx:LayoutLine:Box19
ISEXEC:FALSE
--182.190843:-97.578092:-900.000000
--126.138628:-107.578092:-900.000000
+-137.264220:-139.449705:-900.000000
+-79.704220:-149.449705:-900.000000
PORT
Orientation:"H"
FIN_BOX
BOX
std:MagicBox:Box24
ISEXEC:FALSE
-70.058448:54.161651:-900.000000
-106.133448:44.161651:-900.000000
+66.284148:73.033149:-900.000000
+102.359148:63.033149:-900.000000
FIN_BOX
BOX
std:MagicBox:Box25
PORT
Active:"true"
FIN_BOX
-CONNECTIONS:69
+BOX
+wx:LayoutLine:Box29
+ISEXEC:FALSE
+-234.010495:-17.027092:-900.000000
+-176.450495:-27.027092:-900.000000
+FIN_BOX
+BOX
+wx:CommandButton:Box30
+ISEXEC:FALSE
+-220.568054:36.966713:-900.000000
+-177.793054:26.966713:-900.000000
+PORT
+Label:"Undo"
+FIN_BOX
+BOX
+wx:CommandButton:Box31
+ISEXEC:FALSE
+-211.322007:17.087471:-900.000000
+-168.547007:7.087471:-900.000000
+PORT
+Label:"Redo"
+FIN_BOX
+BOX
+creaMaracasVisu:ManualPaint_UndoRedo:Box32
+ISEXEC:FALSE
+-230.089322:-131.265167:-900.000000
+-180.614322:-141.265167:-900.000000
+PORT
+Type:"2"
+FIN_BOX
+BOX
+creaMaracasVisu:ManualPaint_UndoRedo:Box33
+ISEXEC:FALSE
+-295.989026:-131.212587:-900.000000
+-246.514026:-141.212587:-900.000000
+PORT
+Type:"1"
+FIN_BOX
+BOX
+vtk:UpdateRender:Box34
+ISEXEC:FALSE
+-245.364374:-89.573260:-900.000000
+-205.039374:-99.573260:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box38
+ISEXEC:FALSE
+49.639480:114.047399:-900.000000
+85.714480:104.047399:-900.000000
+FIN_BOX
+CONNECTIONS:79
CONNECTION
Box01:Out:Box02:In
NumberOfControlPoints:0
Box17:Out9:Box01:In9
NumberOfControlPoints:0
CONNECTION
-Box18:Widget:Box19:Widget1
-NumberOfControlPoints:0
-CONNECTION
Box01:Widget:Box19:Widget2
NumberOfControlPoints:0
CONNECTION
MaxRange_ManualPaint_Model:MaxRange_ManualPaint_Model:Box04:In5
NumberOfControlPoints:0
CONNECTION
-Point_ManualPaint_Model:Point_ManualPaint_Model:Box00:Point
-NumberOfControlPoints:0
-CONNECTION
Image_ManualPaint_Model:Image_ManualPaint_Model:Box00:Image
NumberOfControlPoints:0
CONNECTION
CONNECTION
Box00:BoxChange:Box28:BoxExecute
NumberOfControlPoints:0
+CONNECTION
+Box18:Widget:Box29:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box29:Widget:Box19:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box30:Widget:Box29:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box31:Widget:Box29:Widget3
+NumberOfControlPoints:0
+CONNECTION
+Box00:Manualpaintmodel:Box32:Manualpaintmodel
+NumberOfControlPoints:0
+CONNECTION
+Box31:BoxChange:Box32:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box30:BoxChange:Box33:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box00:Manualpaintmodel:Box33:Manualpaintmodel
+NumberOfControlPoints:0
+CONNECTION
+Point_ManualPaint_Model:Point_ManualPaint_Model:Box38:In
+NumberOfControlPoints:0
+CONNECTION
+Box38:Out:Box00:Point
+NumberOfControlPoints:0
+CONNECTION
+Box24:Out:Box33:wxvtkbaseview
+NumberOfControlPoints:0
+CONNECTION
+Box24:Out:Box32:wxvtkbaseview
+NumberOfControlPoints:0
APP_END
new vtk:UpdateRender Box28
set Box28.Active "true"
+new wx:LayoutLine Box29
+
+new wx:CommandButton Box30
+ set Box30.Label "Undo"
+
+new wx:CommandButton Box31
+ set Box31.Label "Redo"
+
+new creaMaracasVisu:ManualPaint_UndoRedo Box32
+ set Box32.Type "2"
+
+new creaMaracasVisu:ManualPaint_UndoRedo Box33
+ set Box33.Type "1"
+
+new vtk:UpdateRender Box34
+
+new std:MagicBox Box38
+
connect Box01.Out Box02.In
connect Box04.Out0 Box02.In0
connect Box17.Out7 Box01.In7
connect Box17.Out8 Box01.In8
connect Box17.Out9 Box01.In9
-connect Box18.Widget Box19.Widget1
connect Box01.Widget Box19.Widget2
connect Box19.Widget Box09.Widget1
connect Box18.Out Box00.Tool
connect Box26.Out Box28.Renderer
connect Box00.BoxChange Box27.BoxExecute
connect Box00.BoxChange Box28.BoxExecute
+connect Box18.Widget Box29.Widget1
+connect Box29.Widget Box19.Widget1
+connect Box30.Widget Box29.Widget2
+connect Box31.Widget Box29.Widget3
+connect Box00.Manualpaintmodel Box32.Manualpaintmodel
+connect Box31.BoxChange Box32.BoxExecute
+connect Box30.BoxChange Box33.BoxExecute
+connect Box00.Manualpaintmodel Box33.Manualpaintmodel
+connect Box38.Out Box00.Point
+connect Box24.Out Box33.wxvtkbaseview
+connect Box24.Out Box32.wxvtkbaseview
# Complex input ports
input TitleOptions Box20.In " "
input GrayLevel_ManualPaint_Model Box04.In3 " "
input MinRange_ManualPaint_Model Box04.In4 " "
input MaxRange_ManualPaint_Model Box04.In5 " "
-input Point_ManualPaint_Model Box00.Point " "
input Image_ManualPaint_Model Box00.Image " "
input BoxExecute_ManualPaint_Model Box00.BoxExecute " "
input Tolerance_Fill_ManualPaint_Model Box04.In6 " "
input wxvtkbaseview1 Box24.In " "
input wxvtkbaseview2 Box25.In " "
input wxvtkbaseview3 Box26.In " "
+input Point_ManualPaint_Model Box38.In " "
# Complex output ports
output widgetOut Box09.Widget " "
//=====
void ManualPaint::Process()
{
-
-/*
- std::string msg;
- if (bbGetInputTitle()!="")
- {
- msg = bbGetInputTitle()+": " + bbGetInputIn();
- }
- else
- {
- msg = bbGetInputIn();
- }
- ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) );
- */
-
if (bbGetInputWxVtkBaseView1()==NULL)
{
wxMessageDialog(NULL, bbtk::std2wx("(ManualPaint) Input 'WxVtkBaseView' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
}
-
if (bbGetInputIn()==NULL)
{
wxMessageDialog(NULL, bbtk::std2wx("(ManualPaint) Input 'vtkImageData' is not set"), bbtk::std2wx(bbGetFullName()) ).ShowModal();
}
-
-
if (firsttime==true)
{
firsttime=false;
-
- ManualPaintModel *mpModel = new ManualPaintModel();
+ ManualPaintModel *mpModel = new ManualPaintModel();
+ ManualPaintControler *mpControler = new ManualPaintControler();
mpModel->SetImages( bbGetInputIn() , bbGetInputIn2() );
-
+ mpControler->SetManualPaintModel(mpModel);
+ mpControler->SetWxVtk2DBaseView( 1, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView1() );
+ mpControler->SetWxVtk2DBaseView( 2, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView2() );
+ mpControler->SetWxVtk2DBaseView( 3, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView3() );
+ mpControler->SetWxVtk2DBaseView( 4, (wxVtk2DBaseView*)bbGetInputWxVtkBaseView4() );
+ mpControler->Config();
wxManualPaintPanel *mpPanel = (wxManualPaintPanel*)bbGetOutputWidget();
-
- if (bbGetInputWxVtkBaseView1()!=NULL)
- {
- ManualPaintControler *mpControler = new ManualPaintControler();
- mpControler->SetManualPaintModel(mpModel);
-// mpControler->SetManualPaintPanel(mpPanel);
- mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView1() );
- mpControler->Config();
- mpPanel->SetManualPaintControler(mpControler);
- }
-
- if (bbGetInputWxVtkBaseView2()!=NULL)
- {
- ManualPaintControler *mpControler = new ManualPaintControler();
- mpControler->SetManualPaintModel(mpModel);
-// mpControler->SetManualPaintPanel(mpPanel);
- mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView2() );
- mpControler->Config();
- mpPanel->SetManualPaintControler(mpControler);
- }
-
- if (bbGetInputWxVtkBaseView3()!=NULL)
- {
- ManualPaintControler *mpControler = new ManualPaintControler();
- mpControler->SetManualPaintModel(mpModel);
-// mpControler->SetManualPaintPanel(mpPanel);
- mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView3() );
- mpControler->Config();
- mpPanel->SetManualPaintControler(mpControler);
- }
-
- if (bbGetInputWxVtkBaseView4()!=NULL)
- {
- ManualPaintControler *mpControler = new ManualPaintControler();
- mpControler->SetManualPaintModel(mpModel);
-// mpControler->SetManualPaintPanel(mpPanel);
- mpControler->SetWxVtk2DBaseView( (wxVtk2DBaseView*)bbGetInputWxVtkBaseView4() );
- mpControler->Config();
- mpPanel->SetManualPaintControler(mpControler);
- }
-
+ mpPanel->SetManualPaintControler(mpControler);
} // firsttime
-
}
+
//=====
// Don't edit this file. This file is generated from xml description..
//=====
//=====
void ManualPaint::bbUserSetDefaultValues()
{
- firsttime=true;
+ firsttime = true;
bbSetInputIn(NULL);
bbSetInputWxVtkBaseView1(NULL);
bbSetInputWxVtkBaseView2(NULL);
if (bbGetInputPoint().size()==3)
{
manualpaintmodel->PaintImage( bbGetInputPoint()[0] , bbGetInputPoint()[1] , bbGetInputPoint()[2] );
+ manualpaintmodel->SetUndoImage();
} // if Points
if ( bbGetInputByLstPointsX().size()!=0 )
{
for (i=0;i<size;i++)
{
manualpaintmodel->PaintImage( bbGetInputByLstPointsX()[i] , bbGetInputByLstPointsY()[i] , bbGetInputByLstPointsZ()[i] );
+// _manualPaintModel->SetUndoImage(); // Probably needed. Here is ok.
} // for
}// if ByLstPointsX
if ((bbGetInputByImagePoints()!=NULL) && (bbGetInputImage2()!=NULL) )
if (vI2==0)
{
manualpaintmodel->PaintImage(i,j,k);
+// manualpaintmodel->SetUndoImage(); // Probably needed. Here is ok.
} // vI2
} // vBIP
pBIP = pBIP + sSBIP;
} else {
bbSetOutputOut( NULL );
}
+ bbSetOutputManualpaintmodel( manualpaintmodel );
}
//=====
// 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(ByLstPointsZ,std::vector<int>);
BBTK_DECLARE_INPUT(Range,std::vector<double>);
BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(Manualpaintmodel,ManualPaintModel*);
BBTK_PROCESS(Process);
void Process();
BBTK_INPUT(ManualPaint_Model,ByLstPointsZ,"Z Lst of points to run the Manual Paint",std::vector<int>,"");
BBTK_INPUT(ManualPaint_Model,Range,"min-max range [0 200] default",std::vector<double>,"");
BBTK_OUTPUT(ManualPaint_Model,Out,"Output image. Is the same pointer of input Image or Image2 with the modifications",vtkImageData*,"");
+ BBTK_OUTPUT(ManualPaint_Model,Manualpaintmodel,"ManualPaintModel",ManualPaintModel*,"");
BBTK_END_DESCRIBE_BLACK_BOX(ManualPaint_Model);
//=====
--- /dev/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)
+//=====
+#include "bbcreaMaracasVisuManualPaint_UndoRedo.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include <wxMPRBaseData.h>
+
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint_UndoRedo)
+BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint_UndoRedo,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_UndoRedo::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;
+
+ if (bbGetInputManualpaintmodel()!=NULL)
+ {
+ if ( bbGetInputType()==1 )
+ {
+ bbGetInputManualpaintmodel()->Undo();
+ } // if Type 1
+ if ( bbGetInputType()==2 )
+ {
+ bbGetInputManualpaintmodel()->Redo();
+ } // if Type 2
+
+
+ if (bbGetInputwxvtkbaseview()!=NULL)
+ {
+
+ vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (bbGetInputwxvtkbaseview()->GetVtkBaseData());
+ vtkmprbasedata->SetX( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointX() );
+ vtkmprbasedata->SetY( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointY() );
+ vtkmprbasedata->SetZ( bbGetInputManualpaintmodel()->GetRestorBaseInitialPointZ() );
+ wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+ #if wxMAJOR_VERSION <= 2
+ bbGetInputwxvtkbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent( newevent );
+ #else
+ bbGetInputwxvtkbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessWindowEvent( newevent );
+ #endif
+ } // if bbGetInputwxvtkbaseview()
+
+
+ } // if bbGetInputManualpaintmodel()
+
+
+
+
+}
+//=====
+// 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_UndoRedo::bbUserSetDefaultValues()
+{
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputType(1);
+ bbSetInputManualpaintmodel(NULL);
+ bbSetInputwxvtkbaseview(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_UndoRedo::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_UndoRedo::bbUserFinalizeProcessing()
+{
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+}
+
+} // EO namespace bbcreaMaracasVisu
+
+
--- /dev/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)
+//=====
+#ifndef __bbcreaMaracasVisuManualPaint_UndoRedo_h_INCLUDED__
+#define __bbcreaMaracasVisuManualPaint_UndoRedo_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "wxVtkBaseView.h"
+#include <ManualPaintModel.h>
+
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT ManualPaint_UndoRedo
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ManualPaint_UndoRedo,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(Manualpaintmodel,ManualPaintModel*);
+ BBTK_DECLARE_INPUT(Type,int);
+ BBTK_DECLARE_INPUT(wxvtkbaseview,wxVtkBaseView*);
+
+// 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_UndoRedo,bbtk::AtomicBlackBox);
+ BBTK_NAME("ManualPaint_UndoRedo");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(ManualPaint_UndoRedo,Manualpaintmodel,"ManualPaintModel",ManualPaintModel*,"");
+ BBTK_INPUT(ManualPaint_UndoRedo,Type,"(Default 1) 1:Undo 2:Redo",int,"");
+ BBTK_INPUT(ManualPaint_UndoRedo,wxvtkbaseview,"wxVtkBaseView",wxVtkBaseView*,"");
+// BBTK_OUTPUT(ManualPaint_UndoRedo,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ManualPaint_UndoRedo);
+//=====
+// 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_UndoRedo_h_INCLUDED__
+
// ----------------------------------------------------------------------------------
Image3DDequeUR::Image3DDequeUR( )
{
+ const void * address = static_cast<const void*>(this);
+ std::stringstream ss;
+ ss << address;
+ m_PrivateID = ss.str();
+
#ifdef _WIN32
this->m_GlobalPath = std::getenv("TEMP");
#endif
imageInfo->SetImageName( this->GetImageName( this->m_ImgURDeque.size( ) ) );
imageInfo->SetImages( imgUndo, imgRedo );
imageInfo->SetImageMManager( imMManager );
+
//Adding to deque
this->m_ImgURDeque.push_back( imageInfo );
this->m_CurrentURPos = this->m_ImgURDeque.size( ) - 1;
//Giving a name to an image using the date and time
if( this->m_IDImages.empty( ) )
{
- time_t rawtime;
- struct tm * timeinfo;
- char buffer[ 80 ];
+ time_t rawtime;
+ struct tm *timeinfo;
+ char buffer[ 80 ];
time( &rawtime );
timeinfo = localtime( &rawtime );
strftime( buffer, 80, "%H%M%S_%a_%d_%b_%y_", timeinfo );
}
std::stringstream ss; //create a stringstream
ss << pos; //add number to the stream
- StringType imageName = this->m_IDImages + ss.str( );
+ StringType imageName = this->m_IDImages + ss.str( )+ "_"+m_PrivateID;
return ( imageName );
}
int m_CurrentURPos; //!<This is the index where is located the undo and redo state.
StringType m_GlobalPath; //!<This is the string with the global path.
StringType m_IDImages; //!<This is the string with the ID of the images (For the filenames).
+ StringType m_PrivateID; //!<This is the string with the private ID of the images (For the filenames).
};
#endif /* IMAGE3DDEQUEUR_H_ */
#include "imageInfoUR.h"
-//#include <iostream>
-//#include <string>
-//#include <vtkImageData.h>
-//#include <vtkSmartPointer.h>
-//#include "imageModificationManager.h"
-
/*! @class ImageDequeUR imageDequeUR.h "imageDequeUR.cxx"
* @brief This class contains the management of the undo/redo - Abstract Class
*/
// ----------------------------------------------------------------------------------
void ImageInfoUR::LoadImagesToMemory(const StringType& gPath)
{
-printf("EED ImageInfoUR::LoadImagesToMemory Start\n");
//setting paths
- StringType filename = gPath + this->m_ImageName;
- StringType undoImagePath = filename + "_Undo.mhd";
- StringType redoImagePath = filename + "_Redo.mhd";
+ StringType filename = gPath + this->m_ImageName;
+ StringType undoImagePath = filename + "_Undo.mhd";
+ StringType redoImagePath = filename + "_Redo.mhd";
//Loading Undo Image
VTKMetaImageReaderPointerType readerUndo = VTKMetaImageReaderPointerType::New();
readerUndo->SetFileName(undoImagePath.c_str());
#endif
//Updating status
this->m_OnMemory = true;
-
-printf("EED ImageInfoUR::LoadImagesToMemory End\n");
-
}
// ----------------------------------------------------------------------------------
bool GetStatus();
// ----------------------------------------------------------------------------------
private:
- VTKImageDataPointerType m_UndoImage; //!<This is the undo image.
- VTKImageDataPointerType m_RedoImage; //!<This is the redo image
- StringType m_ImageName; //!<This is the base name of the images.
- ImageMManagerType* m_ImageMManager; //!<This is the modification manager of the images.
- bool m_OnMemory; //!<This is true if the images are in memory.
- bool m_OnDisk; //!<This is true if the images are in disk.
-
+ VTKImageDataPointerType m_UndoImage; //!<This is the undo image.
+ VTKImageDataPointerType m_RedoImage; //!<This is the redo image
+ StringType m_ImageName; //!<This is the base name of the images.
+ ImageMManagerType *m_ImageMManager; //!<This is the modification manager of the images.
+ bool m_OnMemory; //!<This is true if the images are in memory.
+ bool m_OnDisk; //!<This is true if the images are in disk.
};
#endif /* IMAGEINFO_H_ */
// ----------------------------------------------------------------------------------
ImageMManager::ImageMManager()
{
+ baseInitialPointX=-9999;
+ baseInitialPointY=-9999;
+ baseInitialPointZ=-9999;
}
+
// ----------------------------------------------------------------------------------
ImageMManager::ImageMManager(ImageMManager* manager)
{
-printf("EED ImageMManager::ImageMManager Start\n");
- this->m_RegionStruct = manager->GetModifiedRegion();
- this->m_ValidRegion = manager->ValidateRegion();
-
-if (manager->ValidateRegion()==true) printf("EED ImageMManager::ImageMManager manager->ValidateRegion true \n");
-if (manager->ValidateRegion()==false) printf("EED ImageMManager::ImageMManager manager->ValidateRegion false \n");
-printf("EED ImageMManager::ImageMManager End\n");
+ this->m_RegionStruct = manager->GetModifiedRegion();
+ this->m_ValidRegion = manager->ValidateRegion();
+ this->baseInitialPointX = manager->GetBaseInitialPointX();
+ this->baseInitialPointY = manager->GetBaseInitialPointY();
+ this->baseInitialPointZ = manager->GetBaseInitialPointZ();
}
// ----------------------------------------------------------------------------------
ImageMManager::~ImageMManager()
// ----------------------------------------------------------------------------------
void ImageMManager::AddModifiedPixel(const int& i, const int& j, const int& k)
{
-//printf("EED ImageMManager::AddModifiedPixel \n");
this->CalculateMinMaxRegion(i, j, k);
}
// ----------------------------------------------------------------------------------
return (this->m_RegionStruct);
}
// ----------------------------------------------------------------------------------
+
+void ImageMManager::BaseInitialPoint(int x, int y, int z)
+{
+ baseInitialPointX = x;
+ baseInitialPointY = y;
+ baseInitialPointZ = z;
+}
+
+int ImageMManager::GetBaseInitialPointX()
+{
+ return baseInitialPointX;
+}
+
+int ImageMManager::GetBaseInitialPointY()
+{
+ return baseInitialPointY;
+}
+
+int ImageMManager::GetBaseInitialPointZ()
+{
+ return baseInitialPointZ;
+}
+
*/
RegionStructUR GetModifiedRegion();
// ----------------------------------------------------------------------------------
+
+ void BaseInitialPoint(int x, int y, int z);
+ int GetBaseInitialPointX();
+ int GetBaseInitialPointY();
+ int GetBaseInitialPointZ();
+
private:
// ----------------------------------------------------------------------------------
/*! @fn
void CalculateMinMaxRegion(const int& i, const int& j, const int& k);
// ----------------------------------------------------------------------------------
private:
- RegionStructUR m_RegionStruct; //!< This is the Region structure.
- bool m_ValidRegion; //!< This is true if the region is valid.
+ RegionStructUR m_RegionStruct; //!< This is the Region structure.
+ bool m_ValidRegion; //!< This is true if the region is valid.
+ int baseInitialPointX;
+ int baseInitialPointY;
+ int baseInitialPointZ;
+
};
#endif /* IMAGEMANAGEMENT_H_ */
#include "imageUndoRedo.h"
// ----------------------------------------------------------------------------------
-ImageUndoRedo::ImageUndoRedo( )
+ImageUndoRedo::ImageUndoRedo()
{
this->m_ImagesDeque = new IDequeType( );
}
+
// ----------------------------------------------------------------------------------
//virtual
ImageUndoRedo::~ImageUndoRedo( )
{
-
}
+
// ----------------------------------------------------------------------------------
//virtual
void ImageUndoRedo::Undo( )
{
-printf("EED ImageUndoRedo::Undo Start\n");
ImageInfoUR* imageInfo = this->m_ImagesDeque->Undo( );
if( imageInfo != NULL)
{
this->DrawUR( imageInfo, true );
this->UpdateUndoImage( );
} //if imageInfo
-printf("EED ImageUndoRedo::Undo End\n");
-
}
// ----------------------------------------------------------------------------------
//virtual
void ImageUndoRedo::SetImage( VTKImageDataPointerType image )
{
this->m_CurrentImage = image;
-
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
this->m_CurrentImage->Update( );
// ----------------------------------------------------------------------------------
ImageUndoRedo::VTKImageDataPointerType ImageUndoRedo::GetImageRegion( const RegionSType& region, VTKImageDataPointerType img )
{
-printf("EED ImageUndoRedo::GetImageRegion Start\n");
VTKExtractVOIPointerType extract = VTKExtractVOIPointerType::New( );
extract->SetVOI( region.minX, region.maxX, region.minY, region.maxY,region.minZ, region.maxZ );
-
-printf("EED ImageUndoRedo::GetImageRegion region %d %d %d %d %d %d\n", region.minX, region.maxX, region.minY, region.maxY,region.minZ, region.maxZ );
-
extract->SetSampleRate( 1, 1, 1 );
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
extract->Update();
#endif
VTKImageDataPointerType imgResult = extract->GetOutput( );
-
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
imgResult->Update( );
#else
imgResult->Modified( );
#endif
-
-printf("EED ImageUndoRedo::GetImageRegion End\n");
return ( imgResult );
}
// ----------------------------------------------------------------------------------
//virtual
void ImageUndoRedo::DrawUR( ImageInfoUR* imageInfo, const bool& undo )
{
-printf("EED ImageUndoRedo::DrawUR Start\n");
VTKImageDataPointerType img;
if( undo )
{
} else {
img = imageInfo->GetRedoImage( );
} //else
- RegionSType region = imageInfo->GetImageMManager( )->GetModifiedRegion( );
+ RegionSType region = imageInfo->GetImageMManager()->GetModifiedRegion();
+ m_RestorBaseInitialPointX = imageInfo->GetImageMManager()->GetBaseInitialPointX();
+ m_RestorBaseInitialPointY = imageInfo->GetImageMManager()->GetBaseInitialPointY();
+ m_RestorBaseInitialPointZ = imageInfo->GetImageMManager()->GetBaseInitialPointZ();
+
if( img != NULL)
{
- int *dim = img->GetDimensions( );
-printf("EED ImageUndoRedo::DrawUR dim = %d %d %d\n", dim[0],dim[1],dim[2]);
- int ext[6]; img->GetExtent( ext );
-printf("EED ImageUndoRedo::DrawUR ext = %d %d %d %d %d %d\n", ext[0],ext[1],ext[2],ext[3],ext[4],ext[5] );
-
+ int *dim = img->GetDimensions( );
int sizeXImageIn = dim[ 0 ];
size_t linesize = sizeXImageIn * sizeof(unsigned short);
for( int j = region.minY, y = 0; j <= region.maxY; j++, y++ )
this->m_CurrentImage->Modified( );
} // if img
this->m_ImagesDeque->ManageMemory( );
-printf("EED ImageUndoRedo::DrawUR End\n");
}
// ----------------------------------------------------------------------------------
+
+int ImageUndoRedo::GetRestorBaseInitialPointX()
+{
+ return m_RestorBaseInitialPointX;
+}
+
+int ImageUndoRedo::GetRestorBaseInitialPointY()
+{
+ return m_RestorBaseInitialPointY;
+}
+
+int ImageUndoRedo::GetRestorBaseInitialPointZ()
+{
+ return m_RestorBaseInitialPointZ;
+}
+
VTKImageDataPointerType img);
* @brief This method extract from an image the region of interest (In the undo/redo returns the volume of the modified or t-1 image).
*/
- VTKImageDataPointerType GetImageRegion(const RegionSType& region,
- VTKImageDataPointerType img);
+ VTKImageDataPointerType GetImageRegion(const RegionSType& region,VTKImageDataPointerType img);
+
+ int GetRestorBaseInitialPointX();
+ int GetRestorBaseInitialPointY();
+ int GetRestorBaseInitialPointZ();
+
protected:
// ----------------------------------------------------------------------------------
/*! @fn virtual void DrawUR(ImageInfoUR* imageInfo, const bool& undo);
*/
virtual void DrawUR(ImageInfoUR* imageInfo, const bool& undo);
// ----------------------------------------------------------------------------------
+
protected:
IDequeType *m_ImagesDeque; //!<The manager of the ImagesDeque.
VTKImageDataPointerType m_UndoImage; //!< This is the image for undo t(m_CurrentImage - 1).
VTKImageDataPointerType m_CurrentImage; //!< This is the current image (The modification image).
+ int m_RestorBaseInitialPointX;
+ int m_RestorBaseInitialPointY;
+ int m_RestorBaseInitialPointZ;
+
};
#endif /* IMAGEUNDOREDO_H_ */
{
if (_image != NULL)
{
+ this->_IMManager->BaseInitialPoint(_px, _py ,_pz);
+
float value = (float) _graylevel;
int i, j, k;
{
_tolerancefill = 125;
_distancefill = 5;
-/*
- _limitRecursionFill = 50000;
-*/
_auxImageFill = NULL;
_maxXback = 0;
_maxYback = 0;
if (_auxImageFill != NULL)
{
_auxImageFill->Delete();
- }
+ }//_auxImageFill
}
//---------------------------------------------------------------------------
if ((_px >= _minX) && (_px <= _maxX) && (_py >= _minY) && (_py <= _maxY)
&& (_pz >= _minZ) && (_pz <= _maxZ))
{
+ this->_IMManager->BaseInitialPoint(_px, _py ,_pz);
_graylevelbasefill = _image->GetScalarComponentAsDouble(_px, _py, _pz,0);
_distbasefill = _distancefill * _distancefill;
-/*
- _pxfill = _px;
- _pyfill = _py;
- _pzfill = _pz;
- _countRecursiveFill = 0;
- _countRecursiveFillProblem = 0;
- _countProgressingFill = 0;
- 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
-*/
-// _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
} // while _lstX.size
}
-
-/*
-
-
-//---------------------------------------------------------------------------
-void FillFilter::Run2() // virtual
-{
-
- long int ivi;
- if ((_px >= _minX) && (_px <= _maxX) && (_py >= _minY) && (_py <= _maxY)
- && (_pz >= _minZ) && (_pz <= _maxZ))
- {
- _graylevelbasefill = _image->GetScalarComponentAsDouble(_px, _py, _pz,0);
- _pxfill = _px;
- _pyfill = _py;
- _pzfill = _pz;
- _distbasefill = _distancefill * _distancefill;
- _countRecursiveFill = 0;
- _countRecursiveFillProblem = 0;
- _countProgressingFill = 0;
- _usingAuxImageFill = false;
-
- ivi = _px + _py*(_maxX+1) + _pz*(_maxX+1)*(_maxY+1); // index vector image
-
-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)
-}
-
-//EED01
-// FillToolRecursive(_px, _py, _pz);
- FillToolRecursive(_px, _py, _pz, ivi);
- unsigned char *pImage;
- pImage = (unsigned char *) _auxImageFill->GetScalarPointer();
- int ii, jj, kk;
- ivi = 0;
-
- while (_countRecursiveFillProblem != 0)
- {
- _countRecursiveFillProblem = 0;
- _usingAuxImageFill = true;
- for (kk = 0; kk <= _maxZ; kk++)
- {
- for (jj = 0; jj <= _maxY; jj++)
- {
- for (ii = 0; ii <= _maxX; ii++)
- {
- if (pImage[ivi] == 1)
- {
-//EED01
-// FillToolRecursive(ii, jj, kk);
- FillToolRecursive(ii, jj, kk, ivi);
- } // if
- ivi++;
- } // for ii
- } // for jj
- } //for kk
-// printf("-\n");
- } // while
- } //if _minX _maxX _minY _maxY _minZ _maxZ
-}
-
-
-
//---------------------------------------------------------------------------
-void FillFilter::FillToolRecursive(int px, int py, int pz,long int ivi)
+void FillFilter::SetToleranceFill(double tolerancefill)
{
-//ups ??EED DEF_POINTER_IMAGE_VTK_CREA(v_image,ss_image,p_image,st_image,_image)
-//ups ??EED DEF_POINTER_IMAGE_VTK_CREA(v_image2,ss_image2,p_image2,st_image2,_image2)
-
- _countRecursiveFill++;
- _countProgressingFill++;
- if (_countProgressingFill > 200000)
- {
- printf("R %ld \n", _countRecursiveFill);
- _countProgressingFill = 0;
- }
-
- if ((px >= _minX) && (px <= _maxX) && (py >= _minY) && (py <= _maxY)
- && (pz >= _minZ) && (pz <= _maxZ))
- {
- if (_usingAuxImageFill == true)
- {
-//UPS ??EED this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
-//EED01
-// _auxImageFill->SetScalarComponentFromFloat(px, py, pz, 0, 0);
- _ptrAuxImageFill[ ivi ]=0;
- }
- difX=px-_pxfill;
- difY=py-_pyfill;
- difZ=pz-_pzfill;
- _tmpDistfill = difX*difX + difY*difY + difZ*difZ;
-// _tmpDistfill = (px-_pxfill)*(px-_pxfill)
-// + (py-_pyfill)*(py-_pyfill)
-// + (pz-_pzfill)*(pz-_pzfill);
-
-//if (_countRecursiveFill >1 )
-//{
-// printf(" -> %d %d %d cr=%ld r=%f\n", px,py,pz,_countRecursiveFill , _tmpDistfill);
-//}
-
-
-//EED01
-// _tmpiglfill = _image->GetScalarComponentAsDouble(px, py, pz, 0);
-GETVALUE2_VTK_CREA(_tmpiglfill,p_image,st_image,ivi)
-
- if (_image2!=NULL)
- {
-//EED01
-// _tmpiglfill2 = _image2->GetScalarComponentAsDouble(px, py, pz, 0);
-GETVALUE2_VTK_CREA(_tmpiglfill2,p_image2,st_image2,ivi)
- } else {
- _tmpiglfill2 = _tmpiglfill;
- }
-
- float grayLBFMTOL = _graylevelbasefill - _tolerancefill;
- float grayLBFPTOL = _graylevelbasefill + _tolerancefill;
- bool isInRange = false;
- //DFCH
- if (_RangeMin <= grayLBFMTOL && _RangeMax >= grayLBFPTOL) {
- isInRange = true;
- } //fi esle
- else if (_RangeMin > grayLBFMTOL && _RangeMax >= grayLBFPTOL) {
- grayLBFMTOL = _RangeMin;
- isInRange = true;
- } //fi esle
- else if (_RangeMin <= grayLBFMTOL && _RangeMax < grayLBFPTOL) {
- grayLBFPTOL = _RangeMax;
- isInRange = true;
- } //fi esle
- else if ((_RangeMin <= _graylevelbasefill) && (_graylevelbasefill <= _RangeMax)) {
- grayLBFMTOL = _RangeMin;
- grayLBFPTOL = _RangeMax;
- isInRange = true;
- } //fi Range
-
- if (isInRange)
- {
- _auxGrayLevelValidationFill = (_tmpiglfill != _graylevel)
- && (_tmpiglfill2 != _graylevel)
- && (_tmpiglfill >= grayLBFMTOL)
- && (_tmpiglfill <= grayLBFPTOL)
- && (_tmpDistfill <= _distbasefill); //DFCH
- } else {
- _auxGrayLevelValidationFill = false;
- } // if isInRange
-
-
- if (_auxGrayLevelValidationFill == true)
- {
-//UPS ??EED this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
- if (_image2!=NULL)
- {
-//EED01
-// _image2->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
-SETVALUE2_VTK_CREA(_graylevel,p_image2,st_image2,ivi)
- } else {
-//EED01
-// _image->SetScalarComponentFromFloat(px, py, pz, 0,(float) _graylevel);
-SETVALUE2_VTK_CREA(_graylevel,p_image,st_image,ivi)
- }
-
- if (_countRecursiveFill < _limitRecursionFill)
- {
-
- if (_2D3D == 0) //2D
- {
- if (_direction == 0) // YZ
- {
- //FillToolRecursive(px+1,py,pz);
- //FillToolRecursive(px-1,py,pz);
- FillToolRecursive(px, py + 1, pz, ivi+_OneLine );
- FillToolRecursive(px, py - 1, pz, ivi-_OneLine );
- FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
- FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
- }
- if (_direction == 1) // XZ
- {
- FillToolRecursive(px + 1, py, pz, ivi+_OneColumn);
- FillToolRecursive(px - 1, py, pz, ivi-_OneColumn);
- //FillToolRecursive(px,py+1,pz);
- //FillToolRecursive(px,py-1,pz);
- FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
- FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
- }
- if (_direction == 2) // XY
- {
- FillToolRecursive(px + 1, py, pz, ivi+_OneColumn);
- FillToolRecursive(px, py + 1, pz, ivi+_OneLine);
- FillToolRecursive(px - 1, py, pz, ivi-_OneColumn);
- FillToolRecursive(px, py - 1, pz, ivi-_OneLine);
- //FillToolRecursive(px,py,pz-1);
- //FillToolRecursive(px,py,pz+1);
- }
- } else { // 3D
- FillToolRecursive(px + 1, py, pz, ivi+_OneColumn );
- FillToolRecursive(px - 1, py, pz, ivi-_OneColumn );
- FillToolRecursive(px, py + 1, pz, ivi+_OneLine );
- FillToolRecursive(px, py - 1, pz, ivi-_OneLine );
- FillToolRecursive(px, py, pz - 1, ivi-_OnePlane );
- FillToolRecursive(px, py, pz + 1, ivi+_OnePlane );
- } // 2D 3D
-
- } //_countRecursiveFill
- } // _graylevel
-
- if ((_auxGrayLevelValidationFill == true) && (_countRecursiveFill >= _limitRecursionFill))
- {
- _countRecursiveFillProblem++;
- if (_2D3D == 0) //2D
- {
- if (_direction == 0) // YZ
- {
- //SetAuxImageFill(px+1,py,pz);
- //SetAuxImageFill(px-1,py,pz);
- SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
- SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
- SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
- SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
- }
- if (_direction == 1) // XZ
- {
- SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
- SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
- //SetAuxImageFill(px,py+1,pz);
- //SetAuxImageFill(px,py-1,pz);
- SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
- SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
- }
- if (_direction == 2) // XY
- {
- SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
- SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
- SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
- SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
- //SetAuxImageFill(px,py,pz-1);
- //SetAuxImageFill(px,py,pz+1);
- }
- } else { // 3D
- SetAuxImageFill(px + 1, py, pz,ivi+_OneColumn);
- SetAuxImageFill(px - 1, py, pz,ivi-_OneColumn);
- SetAuxImageFill(px, py + 1, pz,ivi+_OneLine);
- SetAuxImageFill(px, py - 1, pz,ivi-_OneLine);
- SetAuxImageFill(px, py, pz - 1,ivi-_OnePlane);
- SetAuxImageFill(px, py, pz + 1,ivi+_OnePlane);
- } // 2D 3D
-
- } // _graylevel //_limitRecursionFill
-
- } //if _minX _maxX _minY _maxY _minZ _maxZ
- _countRecursiveFill--;
+ _tolerancefill = tolerancefill;
}
-
//---------------------------------------------------------------------------
-void FillFilter::SetAuxImageFill(int px, int py, int pz, long int ivi)
+void FillFilter::SetDistanceFill(int distancefill)
{
- if ((px >= _minX) && (px <= _maxX) && (py >= _minY) && (py <= _maxY)
- && (pz >= _minZ) && (pz <= _maxZ))
- {
- this->_IMManager->AddModifiedPixel(px, py, pz); //DFCH
-//EED01
-// _auxImageFill->SetScalarComponentFromFloat(px, py, pz, 0, 1);
- _ptrAuxImageFill[ ivi ]=1;
- } // if px py pz
+ _distancefill = distancefill;
}
-*/
-
//---------------------------------------------------------------------------
-void FillFilter::SetToleranceFill(double tolerancefill)
+vtkImageData* FillFilter::GetAuxImageFill()
{
- _tolerancefill = tolerancefill;
+ return _auxImageFill;
}
-//---------------------------------------------------------------------------
-void FillFilter::SetDistanceFill(int distancefill)
-{
- _distancefill = distancefill;
-}
public:
FillFilter();
virtual ~FillFilter();
-
void Run();
void FillToolLoop(int px, int py, int pz,long int iviA) ;
-
-/*
- void Run2();
- void FillToolRecursive(int px,int py, int pz, long int ivi);
- void SetAuxImageFill(int px,int py, int pz,long int ivi);
-*/
-
void SetToleranceFill(double tolerancefill);
void SetDistanceFill(int distancefill);
virtual void SetImages(vtkImageData *image,vtkImageData *image2);
-
+ vtkImageData* GetAuxImageFill();
private:
double _tolerancefill;
int _distancefill;
double _graylevelbasefill;
-
double _distbasefill;
double _tmpiglfill;
double _tmpiglfill2;
vtkImageData *_auxImageFill;
-
bool _auxGrayLevelValidationFill;
-
-
int _maxXback;
int _maxYback;
int _maxZback;
-
-/*
-//EED01
- int _pxfill;
- int _pyfill;
- int _pzfill;
- long int _countRecursiveFill;
- long int _countRecursiveFillProblem;
- unsigned char *_ptrAuxImageFill;
- long int _countProgressingFill;
- long int _limitRecursionFill;
- bool _usingAuxImageFill;
- double _tmpDistfill;
- int difX;
- int difY;
- int difZ;
-*/
-
-
protected:
-
//DEF_POINTER_IMAGE_VTK_CREA_definition( v_image , ss_image , p_image , st_image )
- double v_image ;
- int ss_image ;
- char *p_image ;
- int st_image ;
+ double v_image;
+ int ss_image;
+ char *p_image;
+ int st_image;
//macro not working ???
// DEF_POINTER_IMAGE_VTK_CREA_definition(v_image2,ss_image2,p_image2,st_image2)
- double v_image2 ;
- int ss_image2 ;
- char *p_image2 ;
- int st_image2 ;
+ double v_image2;
+ int ss_image2;
+ char *p_image2;
+ int st_image2;
};
ManualPaintControler::ManualPaintControler()
{
auxZ = 0;
- _wxvtk2Dbaseview = NULL;
+// _wxvtk2Dbaseview = NULL;
+ _wxvtk2Dbaseview1 = NULL;
+ _wxvtk2Dbaseview2 = NULL;
+ _wxvtk2Dbaseview3 = NULL;
+ _wxvtk2Dbaseview4 = NULL;
}
//---------------------------------------------------------------------------
}
//---------------------------------------------------------------------------
-//void ManualPaintControler::SetManualPaintPanel( ManualPaintPanel* manualPaintPanel )
-//{
-// _manualPaintPanel = manualPaintPanel;
-//}
-
-//---------------------------------------------------------------------------
-void ManualPaintControler::SetWxVtk2DBaseView( wxVtk2DBaseView *wxvtk2Dbaseview )
+void ManualPaintControler::SetWxVtk2DBaseView( int id, wxVtk2DBaseView *wxvtk2Dbaseview )
{
- _wxvtk2Dbaseview = wxvtk2Dbaseview;
+ if (id==1) { _wxvtk2Dbaseview1 = wxvtk2Dbaseview; }
+ if (id==2) { _wxvtk2Dbaseview2 = wxvtk2Dbaseview; }
+ if (id==3) { _wxvtk2Dbaseview3 = wxvtk2Dbaseview; }
+ if (id==4) { _wxvtk2Dbaseview4 = wxvtk2Dbaseview; }
}
//---------------------------------------------------------------------------
void ManualPaintControler::Config()
{
- if (_wxvtk2Dbaseview != NULL)
+ if (_wxvtk2Dbaseview1 != NULL)
+ {
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview1->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
+ } // if _wxvtk2Dbaseview
+ if (_wxvtk2Dbaseview2 != NULL)
+ {
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview2->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
+ } // if _wxvtk2Dbaseview
+ if (_wxvtk2Dbaseview3 != NULL)
+ {
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview3->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
+ } // if _wxvtk2Dbaseview
+ if (_wxvtk2Dbaseview4 != NULL)
{
- vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview->GetInteractorStyleBaseView());
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*) (_wxvtk2Dbaseview4->GetInteractorStyleBaseView());
isbv->AddInteractorStyleMaracas(new vtkInteractorManualPaint(this));
} // if _wxvtk2Dbaseview
}
//---------------------------------------------------------------------------
-void ManualPaintControler::PaintImage(int px, int py, int pz)
+void ManualPaintControler::PaintImage(int px, int py, int pz,int direction)
{
- _manualPaintModel->SetDirection(_wxvtk2Dbaseview->GetDirection());
+ _manualPaintModel->SetDirection( direction );
_manualPaintModel->PaintImage(px, py, pz);
// The refresh mechanisme is made in the vtkInteractorManualPaint
// RefreshView();
_manualPaintModel->SetUndoImage();
}
-
-
//---------------------------------------------------------------------------
void ManualPaintControler::Undo()
{
_manualPaintModel->Undo();
- Refresh();
+ Refresh_UndoRedo();
}
void ManualPaintControler::Redo()
{
_manualPaintModel->Redo();
- Refresh();
+ Refresh_UndoRedo();
}
-
-void ManualPaintControler::Refresh()
+void ManualPaintControler::Refresh_UndoRedo()
{
- if (_wxvtk2Dbaseview!=NULL)
+ wxVtk2DBaseView *wxvtk2Dbaseview = NULL;
+ if (_wxvtk2Dbaseview1!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview1; }
+ if (_wxvtk2Dbaseview2!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview2; }
+ if (_wxvtk2Dbaseview3!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview3; }
+ if (_wxvtk2Dbaseview4!=NULL){ wxvtk2Dbaseview=_wxvtk2Dbaseview4; }
+ if (wxvtk2Dbaseview!=NULL)
{
- vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (_wxvtk2Dbaseview->GetVtkBaseData());
-// if (bbGetInputPoint().size()==3)
-// {
-// vtkmprbasedata->SetX( bbGetInputPoint()[0] );
-// vtkmprbasedata->SetY( bbGetInputPoint()[1] );
-// vtkmprbasedata->SetZ( bbGetInputPoint()[2] );
- wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ vtkMPRBaseData* vtkmprbasedata = (vtkMPRBaseData*) (wxvtk2Dbaseview->GetVtkBaseData());
+ vtkmprbasedata->SetX( _manualPaintModel->GetRestorBaseInitialPointX() );
+ vtkmprbasedata->SetY( _manualPaintModel->GetRestorBaseInitialPointY() );
+ vtkmprbasedata->SetZ( _manualPaintModel->GetRestorBaseInitialPointZ() );
+ wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
#if wxMAJOR_VERSION <= 2
- _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent );
+ wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent );
#else
- _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent );
+ wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent );
#endif
-// } // if Position
} // _wxvtk2Dbaseview
}
void SetManualPaintModel(ManualPaintModel* manualPaintModel);
ManualPaintModel* GetManualPaintModel();
-// void SetManualPaintPanel(ManualPaintPanel* manualPaintPanel);
- void SetWxVtk2DBaseView(wxVtk2DBaseView *wxvtk2Dbaseview);
+ void SetWxVtk2DBaseView(int id, wxVtk2DBaseView *wxvtk2Dbaseview);
void Config();
- void PaintImage(int px,int py, int pz);
+ void PaintImage(int px,int py, int pz, int direction);
void SetImageUndo();
void Undo();
void Redo();
- void Refresh();
+ void Refresh_UndoRedo();
private:
int auxZ;
ManualPaintModel *_manualPaintModel;
-// ManualPaintPanel *_manualPaintPanel;
- wxVtk2DBaseView *_wxvtk2Dbaseview;
+ wxVtk2DBaseView *_wxvtk2Dbaseview1;
+ wxVtk2DBaseView *_wxvtk2Dbaseview2;
+ wxVtk2DBaseView *_wxvtk2Dbaseview3;
+ wxVtk2DBaseView *_wxvtk2Dbaseview4;
protected:
ManualPaintModel::ManualPaintModel()
{
- _active = true;
- _tool = 0; // 0 pencil , 1 fill
- _brushfilter = new BrushFilter();
- _fillfilter = new FillFilter();
- _imageUndoRedo = new ImageUndoRedo();
+ _active = true;
+ _tool = 0; // 0 pencil , 1 fill
+ _brushfilter = new BrushFilter();
+ _fillfilter = new FillFilter();
+ _imageUndoRedo = new ImageUndoRedo();
+ _imageUndoRedo_visited = new ImageUndoRedo();
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void ManualPaintModel::Set2D3D(int dim2D3D)
{
- _brushfilter->Set2D3D(dim2D3D);
- _fillfilter->Set2D3D(dim2D3D);
+ _brushfilter -> Set2D3D(dim2D3D);
+ _fillfilter -> Set2D3D(dim2D3D);
}
//---------------------------------------------------------------------------
{
_brushfilter -> SetImages(image,image2);
_fillfilter -> SetImages(image,image2);
- _imageUndoRedo->SetImage(image);
+ if (image2!=NULL)
+ {
+ _imageUndoRedo->SetImage(image2);
+ } else {
+ _imageUndoRedo->SetImage(image);
+ }
+ _imageUndoRedo_visited->SetImage( _fillfilter->GetAuxImageFill() );
} else {
printf("EED Warning image=NULL in ManualPaintModel::SetImage(image)\n ");
}
{
imMManager = this->_fillfilter->GetImageMManager();
} // if 1
- this->_imageUndoRedo->SetURImages(imMManager);
- this->_brushfilter->CleanImageMManager();
- this->_fillfilter->CleanImageMManager();
+ this->_imageUndoRedo -> SetURImages(imMManager);
+ this->_imageUndoRedo_visited -> SetURImages(imMManager);
+ this->_brushfilter -> CleanImageMManager();
+ this->_fillfilter -> CleanImageMManager();
}
//---------------------------------------------------------------------------
void ManualPaintModel::Undo()
{
this->_imageUndoRedo->Undo();
+ this->_imageUndoRedo_visited->Undo();
}
void ManualPaintModel::Redo()
{
this->_imageUndoRedo->Redo();
+ this->_imageUndoRedo_visited->Redo();
}
+
+
+int ManualPaintModel::GetRestorBaseInitialPointX()
+{
+ return this->_imageUndoRedo->GetRestorBaseInitialPointX();
+}
+
+int ManualPaintModel::GetRestorBaseInitialPointY()
+{
+ return this->_imageUndoRedo->GetRestorBaseInitialPointY();
+}
+
+int ManualPaintModel::GetRestorBaseInitialPointZ()
+{
+ return this->_imageUndoRedo->GetRestorBaseInitialPointZ();
+}
+
#include "BrushFilter.h"
#include "FillFilter.h"
-//#include "regionStructUR.h"
-//#include "imageUndoRedo.h"
-
#include "imageModificationManager.h"
#include "imageUndoRedo.h"
-
class ManualPaintModel {
public:
ManualPaintModel();
virtual ~ManualPaintModel();
-
void SetActive(bool active);
void SetTool(int tool);
void Set2D3D(int dim2D3D);
void SetRangeMin(int min);
void SetRangeMax(int max);
void GetScalarRange(double * range);
- void SetUndoImage(); //DFCH
- void Undo(); //DFCH
- void Redo(); //DFCH
+ void SetUndoImage(); //DFCH
+ void Undo(); //DFCH
+ void Redo(); //DFCH
+
+ int GetRestorBaseInitialPointX();
+ int GetRestorBaseInitialPointY();
+ int GetRestorBaseInitialPointZ();
private:
int _tool;
BrushFilter *_brushfilter;
FillFilter *_fillfilter;
ImageUndoRedo *_imageUndoRedo;
-
+ ImageUndoRedo *_imageUndoRedo_visited;
protected:
-
};
#endif // _MANUAL_PAINT_MODEL_H_
public:
baseFilterManualPaint();
virtual ~baseFilterManualPaint();
-
virtual void SetImages(vtkImageData *image,vtkImageData *image2);
void SetPoint(int px, int py, int pz);
void Set2D3D(int dim2D3D);
void ResetGeneralMinMax();
void SetGeneralMinMax(int minX, int maxX, int minY, int maxY, int minZ, int maxZ);
void GetScalarRange(double * range);
-
void SetRangeMin( int min );//DFCH
void SetRangeMax( int max );//DFCH
int GetRangeMin( ); //DFCH
int GetRangeMax( ); //DFCH
-
ImageMManager* GetImageMManager(); //DFCH
void CleanImageMManager(); //DFCH
virtual void Run();
-
private:
-
protected:
ImageMManager *_IMManager; //Saves the last modified region (MinX, MaxX, MinY, MaxY, MinZ, MaxZ).
vtkImageData *_image;
double _graylevel;
int _RangeMin;
int _RangeMax;
-
-
};
#endif // _BASE_FILTER_MANUAL_PAINT_H_
//---------------------------------------------------------------------------
bool vtkInteractorManualPaint::OnChar()
{
-printf("EED vtkInteractorManualPaint::OnChar \n");
vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
if (interactor->GetKeyCode() == 97)
{
vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
if (interactor->GetControlKey() == 1) {
_state = true;
-// wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
-// _Z = wxvtk2Dbaseview->GetActualSlice();
+// wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+// _Z = wxvtk2Dbaseview->GetActualSlice();
}
return true;
}
//---------------------------------------------------------------------------
bool vtkInteractorManualPaint::OnLeftButtonUp()
{
-printf("EED vtkInteractorManualPaint::OnLeftButtonUp \n");
if((_state == true) || (_stateKey == true))
{
// _manualPaintControler->SetImageUndo();
double Y = (double) py;
double Z = wxvtk2Dbaseview->GetActualSlice();
wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z, true);
- _manualPaintControler->PaintImage((int) X, (int) Y, (int) Z);
+ _manualPaintControler->PaintImage((int) X, (int) Y, (int) Z, wxvtk2Dbaseview->GetDirection() );
this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-
_manualPaintControler->SetImageUndo();
-
} // if _state
return true;
}
_activeCB->GetId(),
wxEVT_COMMAND_CHECKBOX_CLICKED,
(wxObjectEventFunction) (void (wxPanel::*)(wxCommandEvent&))&wxManualPaintPanel::OnActive);
-
}
void wxManualPaintPanel::OnSldGrayLevel( wxScrollEvent& event )
{
SetGrayLevel( (double) ( _sldGrayLevel->GetValue( )) );
-
wxString text;
text.Printf( wxT("%d"), _sldGrayLevel->GetValue( ) );
_graylevelCtrl->SetValue( text );
void wxManualPaintPanel::OnSldDistanceFill( wxScrollEvent& event )
{
SetDistanceFill( (double) ( _sldDistanceFill->GetValue( )) );
-
wxString text;
text.Printf( wxT("%d"), _sldDistanceFill->GetValue( ) );
_distancefillCtrl->SetValue( text );
void wxManualPaintPanel::OnSldToleranceFill( wxScrollEvent& event )
{
SetToleranceFill( (double) ( _sldToleranceFill->GetValue( )) );
-
wxString text;
text.Printf( wxT("%d"), _sldToleranceFill->GetValue( ) );
_tolerancefillCtrl->SetValue( text );
//---------------------------------------------------------------------------
void wxManualPaintPanel::OnTool( wxCommandEvent &event )
{
-printf("EED wxManualPaintPanel::OnTool Start\n");
DisableControls( );
SetTool( _rbBrushTool->GetSelection( ) );
if( _rbBrushTool->GetSelection( ) == 1 ) //Fill tool
{
-printf("EED wxManualPaintPanel::OnTool 1\n");
_txtToleranceFill->Enable( );
-printf("EED wxManualPaintPanel::OnTool 2\n");
_sldToleranceFill->Enable( );
-printf("EED wxManualPaintPanel::OnTool 3\n");
_tolerancefillCtrl->Enable( );
-
-printf("EED wxManualPaintPanel::OnTool 4\n");
_txtDistanceFill->Enable( );
-printf("EED wxManualPaintPanel::OnTool 5\n");
_sldDistanceFill->Enable( );
-printf("EED wxManualPaintPanel::OnTool 6\n");
_distancefillCtrl->Enable( );
-printf("EED wxManualPaintPanel::OnTool 7\n");
_FillSizer->Show( true );
-printf("EED wxManualPaintPanel::OnTool 8\n");
_brushSizer->Show( false );
-printf("EED wxManualPaintPanel::OnTool 9\n");
this->Layout( );
-printf("EED wxManualPaintPanel::OnTool 10\n");
}
}
void wxManualPaintPanel::onBarrange( wxCommandEvent& event )
{
}
+
void wxManualPaintPanel::onActualChange_Bar( wxCommandEvent& event )
{
/*mbbtkSliderMinMax->bbSetOutputOutActual(modBarRange->GetActual());
mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutActual"));*/
}
+
void wxManualPaintPanel::onStartChange_Bar( wxCommandEvent& event )
{
SetRangeMin( _mBarSlices->GetStart( ) );