#include "wxContourGUIExample.h"
#include "wxContourMainFrame.h"
-//#include "OutlineModelManager.h"
-//#include "wxContourEventHandler.h"
-//#include <creaImageIOWxGimmickDialog.h>
-//#include <creaImageIOWxGimmickReaderDialog.h>
#include <creaImageIOWxSimpleDlg.h>
#include <creaImageIOSystem.h>
#include <creaVtkBasicSlicer.h>
-//#include "wxContourMainPanel.h"
#include "vtkMetaImageReader.h"
#include <map>
#include "vtkImageData.h"
BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,nDimensions)
BBTK_BLACK_BOX_IMPLEMENTATION(nDimensions,bbtk::WxBlackBox);
+
void nDimensions::Process()
{
double **vectx = 0, **vecty = 0, **vectz = 0;
-
std::vector< void * > vectortemp;
std::vector<int> size;
vtkImageData **mask = 0, **value = 0;
-
vtkImageData* img = bbGetInputIn();
-
std::vector<vtkImageData*> selectedimages;
if(img!=NULL && currentimg!=img)
{
currentimg=img;
selectedimages.push_back(img);
wxContourMainFrame::getInstance()->setVectImages(selectedimages);
- }
+ } // if img
- if(currentimg != NULL){
+ if(currentimg != NULL)
+ {
int contourtype = bbGetInputContourType();
//wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size);
//wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype);
- }
-
- bbSetOutputX(vectx);
- bbSetOutputY(vecty);
- bbSetOutputZ(vectz);
- bbSetOutputSizeContour(size);
- bbSetOutputMask(*mask);
- bbSetOutputValue(*value);
+ } // if currentimg
+
+ wxContourMainFrame::getInstance()->RefreshInterface();
+
+
+ bbSetOutputwxContourMainFrame( wxContourMainFrame::getInstance() );
+// bbSetOutputX(vectx);
+// bbSetOutputY(vecty);
+// bbSetOutputZ(vectz);
+// bbSetOutputSizeContour(size);
+// bbSetOutputMask(*mask);
+// bbSetOutputValue(*value);
}
//-----------------------------------------------------------------
#endif // MACOSX
- printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() );
+//printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() );
- wxPanel* panel = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
+ wxContourMainFrame* wxcontourmainframe = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
wxContourMainFrame::getInstance()->ShowToolsPanel(false);
-//EED bbSetOutputWidget( panel );
- bbSetOutputWidget( new wxPanel(parent,-1) );
+
+// bbSetOutputWidget( new wxPanel(parent,-1) );
+ bbSetOutputWidget( wxcontourmainframe );
}
//-----------------------------------------------------------------
BBTK_DECLARE_OUTPUT(Y,double**);
BBTK_DECLARE_OUTPUT(Z,double**);
BBTK_DECLARE_OUTPUT(SizeContour,std::vector <int>);
+ BBTK_DECLARE_OUTPUT(wxContourMainFrame,wxContourMainFrame*);
private:
//wxContourMainFrame* frame;
};
BBTK_BEGIN_DESCRIBE_BLACK_BOX(nDimensions, bbtk::WxBlackBox);
-BBTK_NAME("nDimensions");
-BBTK_AUTHOR("car-prie@uniandes.edu.co");
-BBTK_DESCRIPTION("With a given image, the box shows the nDimension application");
-BBTK_CATEGORY("contours");
-BBTK_INPUT(nDimensions,WorkDir,"Working data directory where config and data files are located",std::string,"");
-BBTK_INPUT(nDimensions,In,"Image to be shown",vtkImageData*,"");
-BBTK_INPUT(nDimensions,ContourType,"Contour type to be exported: ",int,"");
+ BBTK_NAME("nDimensions");
+ BBTK_AUTHOR("car-prie@uniandes.edu.co");
+ BBTK_DESCRIPTION("With a given image, the box shows the nDimension application");
+ BBTK_CATEGORY("contours");
+ BBTK_INPUT(nDimensions,WorkDir,"Working data directory where config and data files are located",std::string,"");
+ BBTK_INPUT(nDimensions,In,"Image to be shown",vtkImageData*,"");
+ BBTK_INPUT(nDimensions,ContourType,"(default 0) Contour type to be exported: ",int,"");
-BBTK_OUTPUT(nDimensions, Mask, "Mask of the contours",vtkImageData*,"");
-BBTK_OUTPUT(nDimensions, Value, "Value of the contours",vtkImageData*,"");
-BBTK_OUTPUT(nDimensions, X, "Array of arrays that contains the X coordinates of each contour", double**, "");
-BBTK_OUTPUT(nDimensions, Y, "Array of arrays that contains the Y coordinates of each contour", double**, "");
-BBTK_OUTPUT(nDimensions, Z, "Array of arrays that contains the Z coordinates of each contour", double**, "");
-BBTK_OUTPUT(nDimensions, SizeContour, "Vector that contains the coordinates of each contour", std::vector <int>, "");
+ BBTK_OUTPUT(nDimensions, Mask, "Mask of the contours",vtkImageData*,"");
+ BBTK_OUTPUT(nDimensions, Value, "Value of the contours",vtkImageData*,"");
+ BBTK_OUTPUT(nDimensions, X, "Array of arrays that contains the X coordinates of each contour", double**, "");
+ BBTK_OUTPUT(nDimensions, Y, "Array of arrays that contains the Y coordinates of each contour", double**, "");
+ BBTK_OUTPUT(nDimensions, Z, "Array of arrays that contains the Z coordinates of each contour", double**, "");
+ BBTK_OUTPUT(nDimensions, SizeContour, "Vector that contains the coordinates of each contour", std::vector <int>, "");
+ BBTK_OUTPUT(nDimensions, wxContourMainFrame, "wxContourMainFrame", wxContourMainFrame*, "");
BBTK_END_DESCRIBE_BLACK_BOX(nDimensions);
}
--- /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 "bbcreaContoursGetWxVtkBaseView.h"
+#include "bbcreaContoursPackage.h"
+
+#include "wxContourMainFrame.h"
+
+namespace bbcreaContours
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,GetWxVtkBaseView)
+BBTK_BLACK_BOX_IMPLEMENTATION(GetWxVtkBaseView,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 GetWxVtkBaseView::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 (bbGetInputWxContourMainFrame()!=NULL)
+ {
+ bbSetOutputOut( bbGetInputWxContourMainFrame()->GetWxVtkBaseView() );
+ } // if Instance
+
+
+}
+//=====
+// 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 GetWxVtkBaseView::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+// bbSetInputIn(0);
+
+}
+//=====
+// 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 GetWxVtkBaseView::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 GetWxVtkBaseView::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaContours
+
+
--- /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 __bbcreaContoursGetWxVtkBaseView_h_INCLUDED__
+#define __bbcreaContoursGetWxVtkBaseView_h_INCLUDED__
+
+#include "bbcreaContours_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "wxVtkBaseView.h"
+#include "wxContourMainFrame.h"
+
+namespace bbcreaContours
+{
+
+class bbcreaContours_EXPORT GetWxVtkBaseView
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(GetWxVtkBaseView,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(WxContourMainFrame,wxContourMainFrame*);
+ BBTK_DECLARE_OUTPUT(Out,wxVtkBaseView* );
+ 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(GetWxVtkBaseView,bbtk::AtomicBlackBox);
+ BBTK_NAME("GetWxVtkBaseView");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(GetWxVtkBaseView,WxContourMainFrame,"wxContourMainFrame",wxContourMainFrame*,"");
+
+ BBTK_OUTPUT(GetWxVtkBaseView,Out,"wxVtkBaseView",wxVtkBaseView*,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(GetWxVtkBaseView);
+//=====
+// 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 bbcreaContours
+
+#endif // __bbcreaContoursGetWxVtkBaseView_h_INCLUDED__
+
--- /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 "bbcreaContoursOnSave.h"
+#include "bbcreaContoursPackage.h"
+
+#include "wxContourMainFrame.h"
+
+namespace bbcreaContours
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,OnSave)
+BBTK_BLACK_BOX_IMPLEMENTATION(OnSave,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 OnSave::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 (wxContourMainFrame::getInstance()!=NULL)
+ {
+ if ( wxContourMainFrame::getInstance()->GetFileLocation().empty()==false )
+ {
+ wxContourMainFrame::getInstance()->onSave();
+ } // if FileLocation
+ } // if getInstance
+}
+//=====
+// 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 OnSave::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+// bbSetInputIn(0);
+
+}
+//=====
+// 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 OnSave::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 OnSave::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaContours
+
+
--- /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 __bbcreaContoursOnSave_h_INCLUDED__
+#define __bbcreaContoursOnSave_h_INCLUDED__
+
+#include "bbcreaContours_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbcreaContours
+{
+
+class bbcreaContours_EXPORT OnSave
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(OnSave,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_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(OnSave,bbtk::AtomicBlackBox);
+ BBTK_NAME("OnSave");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+// BBTK_INPUT(OnSave,Active,"(default false) true/false",bool,"");
+
+// BBTK_OUTPUT(OnSave,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(OnSave);
+//=====
+// 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 bbcreaContours
+
+#endif // __bbcreaContoursOnSave_h_INCLUDED__
+
--- /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 "bbcreaContoursSetColorLayerImage.h"
+#include "bbcreaContoursPackage.h"
+
+#include "wxContourMainFrame.h"
+
+namespace bbcreaContours
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,SetColorLayerImage)
+BBTK_BLACK_BOX_IMPLEMENTATION(SetColorLayerImage,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 SetColorLayerImage::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 (wxContourMainFrame::getInstance()!=NULL)
+ {
+ if (bbGetInputIn()!=NULL)
+ {
+ wxContourMainFrame *wxcontourmainframe=wxContourMainFrame::getInstance();
+ wxcontourmainframe->SetColorLayerImage( bbGetInputIn() );
+ } // InputIn
+ } // if Instance
+
+}
+//=====
+// 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 SetColorLayerImage::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputIn(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 SetColorLayerImage::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 SetColorLayerImage::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaContours
+
+
--- /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 __bbcreaContoursSetColorLayerImage_h_INCLUDED__
+#define __bbcreaContoursSetColorLayerImage_h_INCLUDED__
+
+#include "bbcreaContours_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "vtkImageData.h"
+
+
+namespace bbcreaContours
+{
+
+class bbcreaContours_EXPORT SetColorLayerImage
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(SetColorLayerImage,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(wxContourMainFrame,wxContourMainFrame*);
+ BBTK_DECLARE_INPUT(In,vtkImageData*);
+// 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(SetColorLayerImage,bbtk::AtomicBlackBox);
+ BBTK_NAME("SetColorLayerImage");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+// BBTK_INPUT(SetColorLayerImage,wxContourMainFrame,"wxContourMainFrame",wxContourMainFrame*,"");
+ BBTK_INPUT(SetColorLayerImage,In,"Input image",vtkImageData*,"");
+// BBTK_OUTPUT(SetColorLayerImage,Out,"First output",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(SetColorLayerImage);
+//=====
+// 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 bbcreaContours
+
+#endif // __bbcreaContoursSetColorLayerImage_h_INCLUDED__
+
--- /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 "bbcreaContoursSetFileLocation.h"
+#include "bbcreaContoursPackage.h"
+
+#include "wxContourMainFrame.h"
+
+namespace bbcreaContours
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,SetFileLocation)
+BBTK_BLACK_BOX_IMPLEMENTATION(SetFileLocation,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 SetFileLocation::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 (wxContourMainFrame::getInstance()!=NULL)
+ {
+ if (wxContourMainFrame::getInstance()->GetFileLocation().empty()==true)
+ {
+ wxContourMainFrame::getInstance()->SetFileLocation(bbGetInputFileLocation() );
+ }else {
+ wxContourMainFrame::getInstance()->onSave();
+ wxContourMainFrame::getInstance()->deleteAllContours();
+ wxContourMainFrame::getInstance()->SetFileLocation(bbGetInputFileLocation() );
+ } // if FileLocaton
+
+ wxContourMainFrame::getInstance()->onLoad();
+ wxContourMainFrame::getInstance()->RefreshInterface();
+ } // if Instance
+}
+//=====
+// 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 SetFileLocation::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputFileLocation("");
+
+}
+//=====
+// 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 SetFileLocation::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 SetFileLocation::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaContours
+
+
--- /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 __bbcreaContoursSetFileLocation_h_INCLUDED__
+#define __bbcreaContoursSetFileLocation_h_INCLUDED__
+
+#include "bbcreaContours_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbcreaContours
+{
+
+class bbcreaContours_EXPORT SetFileLocation
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(SetFileLocation,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(FileLocation, std::string);
+// 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(SetFileLocation,bbtk::AtomicBlackBox);
+ BBTK_NAME("SetFileLocation");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(SetFileLocation,FileLocation,"File Location",std::string,"");
+
+// BBTK_OUTPUT(SetFileLocation,Out,"First output",double,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(SetFileLocation);
+//=====
+// 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 bbcreaContours
+
+#endif // __bbcreaContoursSetFileLocation_h_INCLUDED__
+
--- /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 "bbcreaContoursSetViewerPosition.h"
+#include "bbcreaContoursPackage.h"
+namespace bbcreaContours
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,SetViewerPosition)
+BBTK_BLACK_BOX_IMPLEMENTATION(SetViewerPosition,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 SetViewerPosition::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 (bbGetInputPosition().size()==3 )
+ {
+ int x = bbGetInputPosition()[0];
+ int y = bbGetInputPosition()[1];
+ int z = bbGetInputPosition()[2];
+ if ((backX!=x) || (backY!=y) || (backZ!=z) ) // this prevent to finish contour before start :-)
+ {
+ if (bbGetInputwxContourMainFrame()!=NULL)
+ {
+ double slice;
+ vtkImageData *img = bbGetInputwxContourMainFrame()->getImageData();
+ int ext[6];
+ img->GetExtent(ext);
+ int dimY=ext[3]-ext[2]+1;
+ if (bbGetInputDirection()==0)
+ {
+ slice = z;
+ slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
+ bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
+ bbGetInputwxContourMainFrame()->SetXY(x,y);
+ } // if Direction1
+
+ if (bbGetInputDirection()==1)
+ {
+ slice = y;
+ slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
+ bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
+ bbGetInputwxContourMainFrame()->SetXY(x,dimY-z-1);
+ } // if Direction1
+
+ if (bbGetInputDirection()==2)
+ {
+ slice = x;
+ slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift();
+ bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice );
+ bbGetInputwxContourMainFrame()->SetXY(dimY-z-1,y);
+ } // if Direction1
+ bbGetInputwxContourMainFrame()->showAxis(true);
+ bbGetInputwxContourMainFrame()->changeInstant();
+ bbGetInputwxContourMainFrame()->RefreshInterface();
+ backX=x;
+ backY=y;
+ backZ=z;
+ } // if bbGetInputPosition
+ } // if bbGetInputwxContourMainFrame
+ } // if backX backY backZ
+
+}
+//=====
+// 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 SetViewerPosition::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputDirection(0);
+ bbSetInputJump(1);
+ bbSetInputShift(0);
+ bbSetInputwxContourMainFrame(NULL);
+
+ backX=-9999;
+ backY=-9999;
+ backZ=-9999;
+
+}
+//=====
+// 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 SetViewerPosition::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 SetViewerPosition::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaContours
+
+
--- /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 __bbcreaContoursSetViewerPosition_h_INCLUDED__
+#define __bbcreaContoursSetViewerPosition_h_INCLUDED__
+
+#include "bbcreaContours_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "wxContourMainFrame.h"
+
+namespace bbcreaContours
+{
+
+class bbcreaContours_EXPORT SetViewerPosition
+ :public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(SetViewerPosition,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(wxContourMainFrame,wxContourMainFrame*);
+ BBTK_DECLARE_INPUT(Position,std::vector<int>);
+ BBTK_DECLARE_INPUT(Direction,int);
+ BBTK_DECLARE_INPUT(Jump,int);
+ BBTK_DECLARE_INPUT(Shift,int);
+// BBTK_DECLARE_OUTPUT(Out,double);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ int backX, backY, backZ;
+//=====
+// 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(SetViewerPosition,bbtk::AtomicBlackBox);
+ BBTK_NAME("SetViewerPosition");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(SetViewerPosition,wxContourMainFrame,"wxContourMainFrame",wxContourMainFrame*,"");
+ BBTK_INPUT(SetViewerPosition,Position,"vector px py pz",std::vector<int>,"");
+ BBTK_INPUT(SetViewerPosition,Direction,"(default 0) 0:XYZ 1:XZY 2:YZX",int,"");
+ BBTK_INPUT(SetViewerPosition,Jump,"Slice jump+shift",int,"");
+ BBTK_INPUT(SetViewerPosition,Shift,"Slice jump+shift",int,"");
+
+ //BBTK_OUTPUT(SetViewerPosition,Out,"First output",double,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(SetViewerPosition);
+//=====
+// 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 bbcreaContours
+
+#endif // __bbcreaContoursSetViewerPosition_h_INCLUDED__
+
}
-void interfDeleteMenu::onDeleteContour(wxCommandEvent& event){
- interfMainPanel::getInstance()->onDeleteContour();
-}
-void interfDeleteMenu::onDeleteContoursActSlice(wxCommandEvent& event){
+void interfDeleteMenu::onDeleteContoursActSlice(wxCommandEvent& event)
+{
interfMainPanel::getInstance()->onDeleteContoursActSlice();
}
-void interfDeleteMenu::onDeleteAllContours(wxCommandEvent& event){
+
+void interfDeleteMenu::onDeleteContour(wxCommandEvent& event)
+{
+ interfMainPanel::getInstance()->onDeleteContour();
+}
+
+void interfDeleteMenu::onDeleteAllContours(wxCommandEvent& event)
+{
interfMainPanel::getInstance()->onDeleteAllContours();
}
public:
interfDeleteMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir = "data/Icons");
~interfDeleteMenu();
-
virtual void initButtons(wxEvtHandler* evtHandler) ;
-
private:
/**
** This methods are in charge of responding to the events of button click by the delete panel
** @params wxCommandEvent& the event that call the function
**/
- void onDeleteContour(wxCommandEvent& event);
void onDeleteContoursActSlice(wxCommandEvent& event);
+ void onDeleteContour(wxCommandEvent& event);
void onDeleteAllContours(wxCommandEvent& event);
-
};
#endif
void interfImageToolsMenu::initButtons(wxEvtHandler* evtHandler)
{
-printf("EED interfImageToolsMenu::initButtons start\n");
std::vector<std::string> path, nom;
std::vector<wxObjectEventFunction> funct;
-/*EED Borrame
- path.push_back(datadir + "/Segmentation.png");
- nom.push_back("Find shapes by automatic segmentation");
- funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onSegmentationPressed);
-
- path.push_back(datadir + "/ITK.png");
- nom.push_back("Find shapes by automatic segmentation with ITK");
- funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onSegmentationPressedITK);
-
- path.push_back(datadir + "/snake.png");
- nom.push_back("Find shapes using border snake interaction");
- funct.push_back((wxObjectEventFunction) &interfSegmentationMenu:: onSnakePressed);
-*/
path.push_back(datadir + "/pignon.png");
nom.push_back("Configuration of the window");
funct.push_back((wxObjectEventFunction) &interfImageToolsMenu:: onConfigurationPressed);
this->addButtons(path, nom);
this->setVectorFunction(funct);
this->connectEvents(evtHandler);
-printf("EED interfImageToolsMenu::initButtons End\n");
}
interfImageToolsMenu::~interfImageToolsMenu()
void interfImageToolsMenu::onInformationPressed(wxCommandEvent& event)
{
-printf("EED interfImageToolsMenu::onInformationPressed start\n");
interfMainPanel::getInstance()->onInformationPressed();
-printf("EED interfImageToolsMenu::onInformationPressed end\n");
}
void interfImageToolsMenu::onConfigurationPressed(wxCommandEvent& event)
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
-#include "interfMainPanel.h"
+#include <wx/msgdlg.h>
+#include "interfMainPanel.h"
interfMainPanel *interfMainPanel::interfmainpanel = NULL;
wxFrame *interfMainPanel::_newframe = NULL;
interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler)
{
- _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT);
+ _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(450,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER);
+ _newframe->SetMinSize( wxSize(200,200) );
if(interfmainpanel == NULL)
{
- interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler, datadir);
+ interfmainpanel = new interfMainPanel(_newframe, 450, 900, evtHandler, datadir);
}
_newframe->Show(TRUE);
return interfmainpanel;
interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler)
{
- _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
+ _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(450,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER);
+ _newframe->SetMinSize( wxSize(200,200) );
if(interfmainpanel == NULL)
{
- interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler);
+ interfmainpanel = new interfMainPanel(_newframe, 450, 900, evtHandler);
}
_newframe->Show(TRUE);
return interfmainpanel;
wxContourMainFrame::getInstance()->onCreateContourBullEye(panBull);
}
-void interfMainPanel::onDeleteContour()
+void interfMainPanel::onDeleteContoursActSlice()
{
wxContourMainFrame::getInstance()->showAxis(false);
- wxContourMainFrame::getInstance()->onDeleteContour();
+ wxContourMainFrame::getInstance()->onDeleteContoursActSlice();
}
-void interfMainPanel::onDeleteContoursActSlice()
+void interfMainPanel::onDeleteContour()
{
wxContourMainFrame::getInstance()->showAxis(false);
- wxContourMainFrame::getInstance()->onDeleteContoursActSlice();
+ wxContourMainFrame::getInstance()->onDeleteContour();
}
void interfMainPanel::onDeleteAllContours()
{
- wxContourMainFrame::getInstance()->showAxis(false);
- wxContourMainFrame::getInstance()->onDeleteAllContours();
+ wxMessageDialog *dial;
+ dial=new wxMessageDialog( NULL,
+ wxT("Delete all contours of the system?"),
+ wxT("Warnning!"),
+ wxOK | wxCANCEL | wxICON_QUESTION );
+ if (dial->ShowModal()==wxID_OK)
+ {
+ wxContourMainFrame::getInstance()->showAxis(false);
+ wxContourMainFrame::getInstance()->onDeleteAllContours();
+ } // if OK
}
void interfMainPanel::onCopy()
wxContourMainFrame::getInstance()->onInterpolation(interpolate);
}
+void interfMainPanel::onBeforAfterContour(bool before, bool after)
+{
+ wxContourMainFrame::getInstance()->onBeforeAfterContour(before,after);
+}
+
+void interfMainPanel::onJumpSlice(int step, int shift)
+{
+ wxContourMainFrame::getInstance()->onJumpSlice(step,shift);
+}
+
+void interfMainPanel::onShowTextContour(bool show)
+{
+ wxContourMainFrame::getInstance()->onShowTextContour(show);
+}
+
void interfMainPanel::onConfigurationPressed()
{
// Statistics frame
if(infoWin ==NULL)
{
-printf("EED interfMainPanel::onInformationPressed 0.1\n");
infoWin = new wxFrame (this, -1,_T(" Statistics "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER );
-printf("EED interfMainPanel::onInformationPressed 0.2\n");
infoWin->SetSize( wxSize(825,650) );
wxSize sizepanel(825,675);
-printf("EED interfMainPanel::onInformationPressed 0.3\n");
informationPanel = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin);
-printf("EED interfMainPanel::onInformationPressed 0.3a\n");
-// Borrame wxBoxSizer * sizerPanel = new wxBoxSizer(wxHORIZONTAL);
wxFlexGridSizer * sizerPanel = new wxFlexGridSizer(1);
sizerPanel -> Add( informationPanel, 1, wxEXPAND ,0);
-printf("EED interfMainPanel::onInformationPressed 0.4\n");
infoWin->SetSizer( sizerPanel );
infoWin->SetAutoLayout( true );
infoWin->Layout();
-printf("EED interfMainPanel::onInformationPressed 0.43\n");
infoWin->Show();
}else {
-printf("EED interfMainPanel::onInformationPressed 0.5\n");
-
if (infoWin->IsShown()==true)
{
-printf("EED interfMainPanel::onInformationPressed 0.6\n");
infoWin->Show(false);
} else {
//contourevent->FillGridWithContoursInformation();
-printf("EED interfMainPanel::onInformationPressed 0.7\n");
infoWin->Show(true);
}
}
-printf("EED interfMainPanel::onInformationPressed 1\n");
-
//CMRU 29-08-09-----------------------------------------------------------------------------------------------
if(panelAux == NULL)
{
panelAux = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
}
//------------------------------------------------------------------------------------------------------------
-printf("EED interfMainPanel::onInformationPressed 2\n");
-
// mask view control panel
if(infoPanelMask == NULL){
infoPanelMask = new wxPanel(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
wxPanel *panel = wxContourMainFrame::getInstance()->getMaskImageViewPanel( infoPanelMask );
wxStaticText* stattext = new wxStaticText(infoPanelMask, -1, wxString(_T(" Mask segmentation ")), wxDefaultPosition,
wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
-
flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
-
flexsizer->Add(panel, wxEXPAND);
infoPanelMask->Layout();
-
}
-printf("EED interfMainPanel::onInformationPressed 3\n");
//CMRU 29-08-09-----------------------------------------------------------------------------------------------
//Calibration panel
if(infoPanelCalibration == NULL)
wxPanel *panel = new interfCalibrationPanel(infoPanelCalibration);
wxStaticText* stattext = new wxStaticText(infoPanelCalibration, -1, wxString(_T(" Calibration ")), wxDefaultPosition,
wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
-
flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
-
flexsizer->Add(panel, wxEXPAND);
infoPanelCalibration->Layout();
}
-printf("EED interfMainPanel::onInformationPressed 4\n");
//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
#if wxMAJOR_VERSION <= 2
wxFlexGridSizer* sizer = new wxFlexGridSizer(2);
#endif
sizer->Add(infoPanelMask);
-printf("EED interfMainPanel::onInformationPressed 4.1\n");
sizer->Add(infoPanelCalibration);
-printf("EED interfMainPanel::onInformationPressed 4.2\n");
panelAux->SetSizer(sizer, true);
-printf("EED interfMainPanel::onInformationPressed 4.3\n");
panelAux->SetAutoLayout( true );
-printf("EED interfMainPanel::onInformationPressed 4.4\n");
showPanel(panelAux);
-printf("EED interfMainPanel::onInformationPressed 4.5\n");
//------------------------------------------------------------------
-printf("EED interfMainPanel::onInformationPressed OOJJOOOOOOOOOO......\n");
wxContourMainFrame::getInstance()->changeInstant();
-printf("EED interfMainPanel::onInformationPressed End\n");
}
void onCreateContoursBullEye(wxPanel* panBull);
/////////////////////////////////
- void onDeleteContour();
void onDeleteContoursActSlice();
+ void onDeleteContour();
void onDeleteAllContours();
/////////////////////////
void onCopy();
int getWindowLevel();
void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
void onInterpolation(bool interpolate);
+ void onShowTextContour(bool show);
+ void onBeforAfterContour(bool before, bool after);
+ void onJumpSlice(int step,int shift);
void onSpreadPressed();
void onConfigurationPressed();
void resetAppend();
void interfSegmentationPanelVTK::onSegmentationOneSlice( wxCommandEvent& event )
{
- int isovalue = _isovalue->GetValue();
- int sampling = _sampling->GetValue();
- int method = methodRadiobox->GetSelection();
+ int isovalue = _isovalue->GetValue();
+ int sampling = _sampling->GetValue();
+ int method = methodRadiobox->GetSelection();
interfMainPanel::getInstance()->onSegmentationOneSlice(isovalue, sampling, method);
}
void interfSegmentationPanelVTK::onSegmentationAllSlice( wxCommandEvent& event )
{
- int minZ=_mbarrange->GetStart();
- int maxZ=_mbarrange->GetEnd();
- int isovalue = _isovalue->GetValue();
- int sampling = _sampling->GetValue();
- int method = methodRadiobox->GetSelection();
+ int minZ = _mbarrange->GetStart();
+ int maxZ = _mbarrange->GetEnd();
+ int isovalue = _isovalue->GetValue();
+ int sampling = _sampling->GetValue();
+ int method = methodRadiobox->GetSelection();
interfMainPanel::getInstance()->onSegmentationAllSlice(minZ, maxZ, isovalue, sampling, method);
}
_brithtnessWindowLevel = new wxSlider(this, -1, windowlevel , min, max, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
_brithtnessColorLevel = new wxSlider(this, -1, colorwindow , min, max, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
- _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image interpolation") );
+ _interpolationCheckBox = new wxCheckBox(this, -1, _T("Interpolation") );
_interpolationCheckBox->SetValue(true);
+ _showTextContourCheckBox = new wxCheckBox(this, -1, _T("Labels") );
+ _showTextContourCheckBox->SetValue(true);
+
+ _beforContourCheckBox = new wxCheckBox(this, -1, _T("Befor Contour") );
+ _beforContourCheckBox->SetValue(false);
+
+ _afterContourCheckBox = new wxCheckBox(this, -1, _T("After Contour") );
+ _afterContourCheckBox->SetValue(false);
+
+ wxButton *jumpBackwareSlice = new wxButton(this,-1,_T("-"),wxDefaultPosition, wxDefaultSize);
+ wxButton *jumpFordwareSlice = new wxButton(this,-1,_T("+"),wxDefaultPosition, wxDefaultSize);
+ _jumpSpinCtrl = new wxSpinCtrl(this,-1,wxString("10") );
+ _jumpSpinCtrl->SetRange(1,100);
+ _shiftSpinCtrl = new wxSpinCtrl(this,-1,wxString("0") );
+ _shiftSpinCtrl->SetRange(0,99);
+
Connect( _withOfContourLine->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction) &interfConfigurationPanel::onWidthOfContour);
Connect( _withOfContourLine->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &interfConfigurationPanel::onWidthOfContour);
Connect( _brithtnessColorLevel->GetId() , wxEVT_SCROLL_CHANGED, (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
Connect( _brithtnessColorLevel->GetId() , wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnInterpolation);
+ Connect( _showTextContourCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnShowTextContour);
+ Connect( _beforContourCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnBeforAfterContour);
+ Connect( _afterContourCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnBeforAfterContour);
+ Connect( jumpBackwareSlice->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfConfigurationPanel::OnBackwareSlice );
+ Connect( jumpFordwareSlice->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfConfigurationPanel::OnFordwareSlice );
+
+
+ wxFlexGridSizer * sizerA = new wxFlexGridSizer(1);
+ sizerA -> Add( new wxStaticText(this,-1, _T("Contour width")) , 1, wxGROW );
+ sizerA -> Add( _withOfContourLine , 1, wxGROW );
+ sizerA -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
+ sizerA -> Add( new wxStaticText(this,-1, _T("Window level")) , 1, wxGROW );
+ sizerA -> Add( _brithtnessWindowLevel , 1, wxGROW );
+ sizerA -> Add( new wxStaticText(this,-1, _T("Color level")) , 1, wxGROW );
+ sizerA -> Add( _brithtnessColorLevel , 1, wxGROW );
+ sizerA -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
+
+ wxFlexGridSizer * sizerB1 = new wxFlexGridSizer(2);
+ sizerB1-> Add( jumpBackwareSlice , 1, wxGROW );
+ sizerB1 -> Add( jumpFordwareSlice , 1, wxGROW );
+
+ wxFlexGridSizer * sizerB = new wxFlexGridSizer(1);
+ sizerB -> Add( _interpolationCheckBox , 1, wxGROW );
+ sizerB -> Add( new wxStaticText(this ,-1, _T(" ")) , 1, wxGROW );
+ sizerB -> Add( _showTextContourCheckBox , 1, wxGROW );
+ sizerB -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
+ sizerB -> Add( _beforContourCheckBox , 1, wxGROW );
+ sizerB -> Add( _afterContourCheckBox , 1, wxGROW );
+ sizerB -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
+ sizerB -> Add( sizerB1 , 1, wxGROW );
+ sizerB -> Add( _jumpSpinCtrl , 1, wxGROW );
+ sizerB -> Add( _shiftSpinCtrl , 1, wxGROW );
+
- wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
- sizer -> Add( new wxStaticText(this,-1, _T("Contour width")) , 1, wxGROW );
- sizer -> Add( _withOfContourLine , 1, wxGROW );
- sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
- sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
- sizer -> Add( new wxStaticText(this,-1, _T("Brightness of the image")) , 1, wxGROW );
- sizer -> Add( new wxStaticText(this,-1, _T("--Window level--")) , 1, wxGROW );
- sizer -> Add( _brithtnessWindowLevel , 1, wxGROW );
- sizer -> Add( new wxStaticText(this,-1, _T("--Color level--")) , 1, wxGROW );
- sizer -> Add( _brithtnessColorLevel, 1, wxGROW );
- sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
- sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
- sizer -> Add( _interpolationCheckBox , 1, wxGROW );
+ wxFlexGridSizer * sizer = new wxFlexGridSizer(3);
+ sizer -> Add( sizerA , 1, wxGROW );
+ sizer -> Add( new wxStaticText(this,-1, _T(" ")) , 1, wxGROW );
+ sizer -> Add( sizerB , 1, wxGROW );
this->SetSizer( sizer );
//JCP 13-10-08
{
}
-void interfConfigurationPanel::onWidthOfContour(wxScrollEvent& event){
-
+void interfConfigurationPanel::onWidthOfContour(wxScrollEvent& event)
+{
double width = (double)_withOfContourLine->GetValue() / 2.0;
interfMainPanel::getInstance()->onWidthOfContour(width);
}
void interfConfigurationPanel::onBrigthnessColorWindowLevel(wxScrollEvent& event){
int colorwindow = _brithtnessColorLevel->GetValue();
int windowlevel = _brithtnessWindowLevel->GetValue();
-
interfMainPanel::getInstance()->onBrigthnessColorWindowLevel(colorwindow, windowlevel);
-
}
void interfConfigurationPanel::OnInterpolation(wxCommandEvent& event)
{
interfMainPanel::getInstance()->onInterpolation(_interpolationCheckBox->GetValue());
+}
+void interfConfigurationPanel::OnBeforAfterContour(wxCommandEvent& event)
+{
+ interfMainPanel::getInstance()->onBeforAfterContour(_beforContourCheckBox->GetValue() , _afterContourCheckBox->GetValue() );
+}
+
+void interfConfigurationPanel::OnShowTextContour(wxCommandEvent& event)
+{
+ interfMainPanel::getInstance()->onShowTextContour(_showTextContourCheckBox->GetValue() );
+}
+void interfConfigurationPanel::OnBackwareSlice(wxCommandEvent& event)
+{
+ interfMainPanel::getInstance()->onJumpSlice( -_jumpSpinCtrl->GetValue(), _shiftSpinCtrl->GetValue() );
}
+void interfConfigurationPanel::OnFordwareSlice(wxCommandEvent& event)
+{
+ interfMainPanel::getInstance()->onJumpSlice( _jumpSpinCtrl->GetValue(), _shiftSpinCtrl->GetValue() );
+}
+
+
/**
** Begin of the spread panel
**/
public:
interfConfigurationPanel(wxWindow * parent);
~interfConfigurationPanel();
-
-
-
private:
-
void onWidthOfContour(wxScrollEvent& event);
-
void onBrigthnessColorWindowLevel(wxScrollEvent& event);
-
void OnInterpolation(wxCommandEvent& event);
-
-
- wxSlider* _withOfContourLine;
- wxSlider* _brithtnessWindowLevel;
- wxSlider* _brithtnessColorLevel;
+ void OnShowTextContour(wxCommandEvent& event);
+ void OnBeforAfterContour(wxCommandEvent& event);
+ void OnBackwareSlice(wxCommandEvent& event);
+ void OnFordwareSlice(wxCommandEvent& event);
+ wxSlider* _withOfContourLine;
+ wxSlider* _brithtnessWindowLevel;
+ wxSlider* _brithtnessColorLevel;
wxCheckBox* _interpolationCheckBox;
-
+ wxCheckBox* _showTextContourCheckBox;
+ wxCheckBox* _beforContourCheckBox;
+ wxCheckBox* _afterContourCheckBox;
+ wxSpinCtrl* _jumpSpinCtrl;
+ wxSpinCtrl* _shiftSpinCtrl;
};
class interfSpreadPanel
public:
interfSpreadPanel(wxWindow * parent);
~interfSpreadPanel();
-
void appendStringSpread(std::string val);
void setStringSpread(std::string stringtemp);
private:
-
wxRadioBox *_spreadMethodRadiobox;
wxStaticText *_staticTextSpread;
wxTextCtrl *_wxtextctrlSpread;
-
void onSpreadReset(wxCommandEvent& event);
void onSpreadAdd(wxCommandEvent& event);
void onSpreadAddAll(wxCommandEvent& event);
void onSpreadGo(wxCommandEvent& event);
-
-
-
};
class interfInformationPanel
// Constructors & Destructors
//------------------------------------------------------------------------------------------------------------
-wxContourMainFrame* wxContourMainFrame:: instance = NULL;
+wxContourMainFrame* wxContourMainFrame::instance=NULL;
char wxContourMainFrame::COPY = 'C';
wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,long style)
_viewThresholdImage = NULL;
_viewThresholdImagePanel = NULL;
_viewColorLayerImagePanel = NULL;
-
_frameShowResultImages = NULL;
}
#elif defined(__GNUC__)
std::string str_home(getenv("HOME"));
#endif
- std::string strCreaContourDataTmp = str_home + "/.creaContourDataTemp/";
- std::vector<std::string> conceptNameVect;
- std::vector<int> conceptSizeVect;
- notebook = this->createNotebook();
+ std::string strCreaContourDataTmp = str_home + "/.creaContourDataTemp/";
+ std::vector<std::string> conceptNameVect;
+ std::vector<int> conceptSizeVect;
+ notebook = this->createNotebook();
kernelManager = new KernelManagerContour( imgs , _datadir+"/data/" , strCreaContourDataTmp );
_instantPanel = new wxInstantChooserPanel( notebook, "Instant Chooser", true, false, "c" );
_theViewPanel = new wxContourViewPanel( kernelManager->getSourceImage(), notebook );
wxContourMainFrame* wxContourMainFrame :: getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style,std::string datadir )
{
- if(instance == NULL){
- instance = new wxContourMainFrame(parent, id, title, pos, size, images, style,datadir);
+ if(instance == NULL)
+ {
+ instance=new wxContourMainFrame(parent, id, title, pos, size, images, style,datadir);
}
return instance;
}
- std::vector<vtkImageData*> wxContourMainFrame ::getVectImages()
+ std::vector<vtkImageData*> wxContourMainFrame::getVectImages()
{
return kernelManager->getVectImages();
}
- wxContourMainFrame* wxContourMainFrame :: getInstance()
+ wxContourMainFrame* wxContourMainFrame::getInstance()
{
return instance;
}
- void wxContourMainFrame :: resetInstance()
+ void wxContourMainFrame::resetInstance()
{
instance->Destroy();
}
- wxContourMainFrame :: ~wxContourMainFrame()
+ wxContourMainFrame::~wxContourMainFrame()
{
delete _contourextractdata;
deleteAllContours();
// Creational and initialization methods using WxAui
//------------------------------------------------------------------------------------------------------------
//
- wxAuiNotebook * wxContourMainFrame :: createNotebook()
+ wxAuiNotebook * wxContourMainFrame::createNotebook()
{
wxSize client_size = GetClientSize();
wxAuiNotebook* noteBook = new wxAuiNotebook(this, -1, wxPoint(client_size.x, client_size.y), wxSize(430,200), m_notebook_style);
//------------------------------------------------------------------------------------------------------------
// Creational and initialization methods
//------------------------------------------------------------------------------------------------------------
- bool wxContourMainFrame :: configurePanels( )
+ bool wxContourMainFrame::configurePanels( )
{
bool configured = _theViewPanel!=NULL;
}
}
-void wxContourMainFrame :: createContour( int typeContour )
+void wxContourMainFrame::createContour( int typeContour )
{
//Creating the manualContourModel and including in the model
manualBaseModel * manModelContour = kernelManager->factoryManualContourModel(typeContour);
std::vector<int> instantVector;
_instantPanel->getInstant( instantVector );
+
+ std::vector<int> tempVector;
+ getInstantVector( tempVector );
+ manModelContour->SetLabel2( std::to_string(tempVector[1]) );
+
std::string theName = kernelManager->createOutline(manModelContour, instantVector);
/*std::vector<int> instantVector;
_instantPanel->getInstant( instantVector );
//JCP 21 - 11 - 08
}
-void wxContourMainFrame::onDeleteContoursActSlice(){
+void wxContourMainFrame::onDeleteContoursActSlice()
+{
//JCP 20-10-08 Undo redo implementation
saveState();
//JCP 20-10-08 Undo redo implementation
- deleteContours( (std::vector<std::string>)_theViewPanel->getSceneManager()->GetlstContoursNameActualSlice() );
+
+ std::vector<int> tempVector;
+ getInstantVector( tempVector );
+ deleteContours( getOutlinesName( tempVector[1] ) );
+// deleteContours( (std::vector<std::string>)_theViewPanel->getSceneManager()->GetlstContoursNameActualSlice() );
+
}
void wxContourMainFrame::onDeleteAllContours(){
//JCP 20-10-08 Undo redo implementation
_instantPanel->getInstant(inst);
vtkImageData* img = kernelManager->getImageAtInstant(inst);
- if(img!=NULL){
+ if(img!=NULL)
+ {
_theViewPanel->changeImage(img);
showAxis(false);
}else{
int z = _instantPanel->getConceptDataOf("Axe Depth")->getActualValue();
_theViewPanel->setImageSlice(z);
- }
+ } // if img
}
void wxContourMainFrame::updateInstantAxes()
mp->SetPointX( vecOut[0] );
mp->SetPointY( vecOut[1] );
mp->SetPointZ( vecOut[2] );
- }
+ } // for i
_theViewPanel->getSceneManager()->createCopyContourOf( anExistingKName, cloneName, manualModel , append );
}
onLoadContours(filename,false);
}
-
void wxContourMainFrame::onLoad()
{
std::string fileNameContourROI = GetFileLocation();
if (dialog.ShowModal() == wxID_OK)
{
fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
- }
- }
-
+ } // if dialog
+ } // if FileLocation
onLoadContours(fileNameContourROI,true);
}
-
void wxContourMainFrame::SetZForAllContours(int pz)
{
//-- Normal Contours
std::vector< std::string > lstNameThings;
int i,sizeLstNameThings;
- int ii,sizeLstPoints;
-
+ int ii,sizeLstPoints;
lstNameThings = kernelManager->GetLstNameThings();
sizeLstNameThings = lstNameThings.size();
for (i=0 ; i<sizeLstNameThings ; i++)
readDimSpc(pFile,false); // DimSpc interactive OFF
openContours(pFile,pFileData,true); // Load StaticContours
SetZForAllContours(-900);
- }
- //AD:02-06-09
- else if (version=="1.0.1")
- {
+ } else if (version=="1.0.1") { //AD:02-06-09
openContours(pFile,pFileData,false); //Skips ImageDimensions and ImageSpacing
openContours(pFile,pFileData,true); //Load StaticContours, skips ImageDimensions and ImageSpacing
- }
-
- //AD:02-06-09
- else if (version=="1.0.0")
- {
+ } else if (version=="1.0.0") { //AD:02-06-09
openContours(pFile,pFileData,false); //Skips ImageDimensions and ImageSpacing
}
-
fclose(pFile);
-
if(pFileData != NULL)
{
fclose(pFileData);
} // if
- }
+ } // pFile
_theViewPanel->getSceneManager()->removeSceneContours();
changeInstant();
}
filename = dialog.GetPath().mb_str();
filenamecontours = kernelManager->parseOsirixFile(filename);
- if(filenamecontours.compare("") != 0){
+ if(filenamecontours.compare("") != 0)
+ {
onLoadContours(filenamecontours,true);
} // if
} // if
#else
wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxFD_OPEN );
#endif
-
if (dialog.ShowModal() == wxID_OK)
{
filename = dialog.GetPath().mb_str();
} // if
}
-
//AD: 29-05-09
-void wxContourMainFrame::onSave(){
+void wxContourMainFrame::onSave()
+{
//CMRU 03-09-09-----------------------------------------------------------------------------------------------
if(GetFileLocation().empty())
{
kernelManager->setCurrentFileName(fileNameContourROI);
saveFileWithContours( fileNameContourROI );
}
- }
-//CMRU 03-09-09-----------------------------------------------------------------------------------------------
- else
- {
+ } else {//CMRU 03-09-09-----------------------------------------------------------------------------------------------
std::cout<<"Nombre del archivo: "<<GetFileLocation()<<std::endl;
std::string fileNameContourROI = GetFileLocation();
std::cout<<"Nombre del archivo: "<<fileNameContourROI<<std::endl;
{
wxDialog* dial = new wxDialog (this,-1,_T("Tools"),wxDefaultPosition, wxSize(460,360));
wxSizer* buttonsSizer = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL);
- wxBoxSizer *dialSizer = new wxBoxSizer(wxVERTICAL);
+// wxBoxSizer *dialSizer = new wxBoxSizer(wxVERTICAL);
+ wxFlexGridSizer *dialSizer = new wxFlexGridSizer(1);
- wxString lstOptOperation[2];
- lstOptOperation[0]=_T("By Dimension");
- lstOptOperation[1]=_T("By Spacing");
- wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,45), 2 , lstOptOperation, 2, wxRA_SPECIFY_COLS);
+ wxString lstOptOperation[3];
+ lstOptOperation[0]=_T("By Dimension (XY)");
+ lstOptOperation[1]=_T("By Spacing (XY)");
+ lstOptOperation[2]=_T("By Spacing (XYZ)");
+ wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(370,200), 3 , lstOptOperation, 3, wxRA_SPECIFY_ROWS);
dialSizer->Add( new wxStaticText(dial,-1,_T("The image resolution is not compatible with the ")) , 0, wxGROW );
dialSizer->Add( new wxStaticText(dial,-1,_T("selected Roi file. Do you want to tranform it?")) , 0, wxGROW );
dial->Layout();
dial->ShowModal();
- int _tmpReadFileTypeOfTransformation = -1;
+ _tmpReadFileTypeOfTransformation = -1;
//EED bool transform = false;
if (dial->GetReturnCode() == wxID_OK)
//AD:04-06-09
void wxContourMainFrame::openContours( FILE *pFile, FILE *pFileData, bool staticContour )
{
-
+printf ("EED wxContourMainFrame::openContours Start \n");
char tmp[255];
vtkImageData *image = _images[0];
//nothing to do..
} else if (_tmpReadFileTypeOfTransformation==0){
double transX, transY;
- transX = (double) imageDim[0]/_tmpReadFileImageDim[0];
- transY = (double) imageDim[1]/_tmpReadFileImageDim[1];
- manModelContour->Transform_Ax_Plus_B(transX,0,transY,0);
+ transX = (double) imageDim[0]/_tmpReadFileImageDim[0]; // X
+ transY = (double) imageDim[1]/_tmpReadFileImageDim[1]; // Y
+ manModelContour->Transform_Ax_Plus_B(transX,0,transY,0);
} else if (_tmpReadFileTypeOfTransformation==1) {
double transX, transY;
- transX = (double) _tmpReadFileImageSpac[0]/imageDim[0];
- transY = (double) _tmpReadFileImageSpac[1]/imageDim[1];
+ transX = (double) _tmpReadFileImageSpac[0]/imageSpac[0]; // X
+ transY = (double) _tmpReadFileImageSpac[1]/imageSpac[1]; // Y
+ manModelContour->Transform_Ax_Plus_B(transX,0,transY,0);
+ } else if (_tmpReadFileTypeOfTransformation==2) { // with Z include
+ double transX, transY;
+ transX = (double) _tmpReadFileImageSpac[0]/imageSpac[0]; // X
+ transY = (double) _tmpReadFileImageSpac[1]/imageSpac[1]; // Y
+ instantVector[1]=instantVector[1]*_tmpReadFileImageSpac[2]/imageSpac[2]; // Z
manModelContour->Transform_Ax_Plus_B(transX,0,transY,0);
+ }else {
+ printf ("EED Warnning! wxContourMainFrame::openContours _tmpReadFileTypeOfTransformation not set. \n");
}
fscanf(pFile,"%s",tmp); // TypeView
/* } */
+printf ("EED wxContourMainFrame::openContours END \n");
+
}
void wxContourMainFrame::RefreshInterface()
int typeofcontour = 1;
//Image Data
vtkImageData *imagedata = getImageData();
-
//Tipo de pixeles a utilizar internamente en ITK
typedef float InternalPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InternalPixelType, Dimension > InternalImageType;
-
//Tipo de pixeles de salida 1
typedef unsigned char OutputPixelType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
-
//Tipo de pixeles de salida 2
typedef unsigned short OutputPixelType2;
typedef itk::Image< OutputPixelType2, Dimension > OutputImageType2;
-
//DefiniciÛn del thresholder
typedef itk::BinaryThresholdImageFilter<
InternalImageType,
OutputImageType > ThresholdingFilterType;
-
//DefiniciÛn del primer filtro de conversiÛn de pixeles
typedef itk::CastImageFilter<
OutputImageType, OutputImageType2 > CastFilterType;
-
//DefiniciÛn del segundo tipo de conversiÛn de pixeles
typedef itk::CastImageFilter<
OutputImageType2, InternalImageType > CastFilterType2;
-
//Tercer tipo de conversiÛn
typedef itk::RescaleIntensityImageFilter<
InternalImageType,
OutputImageType > CastFilterType3;
-
//Cuarto tipo de conversiÛn
typedef itk::RescaleIntensityImageFilter<
OutputImageType,
OutputImageType > CastFilterType4;
-
ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();
-
thresholder->SetLowerThreshold( 0.0 );
thresholder->SetUpperThreshold( 128 );
-
thresholder->SetOutsideValue( 255 );
thresholder->SetInsideValue( 0 );
-
//DefinciÛn de conexiÛnes entre VTK e ITK y el writer
typedef itk::VTKImageToImageFilter<OutputImageType2> ConnectorType;
typedef itk::ImageToVTKImageFilter<OutputImageType> ConnectorType2;
//EED10JUIN2011 typedef itk::ImageFileWriter< OutputImageType > WriterType;
-
- ConnectorType::Pointer connector= ConnectorType::New();
- ConnectorType2::Pointer connector2= ConnectorType2::New();
-
-
- CastFilterType::Pointer filter=CastFilterType::New();
- CastFilterType2::Pointer filter2=CastFilterType2::New();
-
+ ConnectorType::Pointer connector = ConnectorType::New();
+ ConnectorType2::Pointer connector2 = ConnectorType2::New();
+ CastFilterType::Pointer filter = CastFilterType::New();
+ CastFilterType2::Pointer filter2 = CastFilterType2::New();
connector->SetInput( imagedata );
filter2->SetInput(connector->GetOutput());
-
typedef itk::CurvatureAnisotropicDiffusionImageFilter<
InternalImageType,
InternalImageType > SmoothingFilterType;
-
SmoothingFilterType::Pointer smoothing = SmoothingFilterType::New();
-
typedef itk::GradientMagnitudeRecursiveGaussianImageFilter<
InternalImageType,
InternalImageType > GradientFilterType;
-
typedef itk::SigmoidImageFilter<
InternalImageType,
InternalImageType > SigmoidFilterType;
-
GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New();
-
SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New();
-
sigmoid->SetOutputMinimum( 0.0 );
sigmoid->SetOutputMaximum( 255.0 );
-
-
typedef itk::FastMarchingImageFilter<
InternalImageType,
InternalImageType > FastMarchingFilterType;
-
-
FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();
-
-printf("EED wxContourMainFrame::SegmentationOneSliceITK Skypping this code. Not compiling GeodesicActiveContourLevelSetImageFilter in fedora 17 with ITK 3.20.1 \n ");
-/*EED 17 sept 2010
- > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - Not compiling GeodesicActiveContourLevelSetImageFilter in fedora 17 with ITK 3.20.1
-
-
typedef itk::GeodesicActiveContourLevelSetImageFilter< InternalImageType,
InternalImageType > GeodesicActiveContourFilterType;
GeodesicActiveContourFilterType::Pointer geodesicActiveContour =
GeodesicActiveContourFilterType::New();
-
typedef itk::ZeroCrossingImageFilter<
InternalImageType,
InternalImageType > ZeroCrossingFilterType;
ZeroCrossingFilterType::Pointer zeroCrossing =
ZeroCrossingFilterType::New();
-
const double propagationScaling = atof( crea::wx2std(prop).c_str() );
-
geodesicActiveContour->SetPropagationScaling( propagationScaling );
geodesicActiveContour->SetCurvatureScaling( 1.0 );
geodesicActiveContour->SetAdvectionScaling( 1.0 );
-
geodesicActiveContour->SetMaximumRMSError( 0.02 );
int it=atoi( crea::wx2std(iter).c_str() );
geodesicActiveContour->SetNumberOfIterations( it );
-
smoothing->SetInput( filter2->GetOutput() );
gradientMagnitude->SetInput( smoothing->GetOutput() );
sigmoid->SetInput( gradientMagnitude->GetOutput() );
fastMarching->SetInput( sigmoid->GetOutput() );
geodesicActiveContour->SetInput( fastMarching->GetOutput() );
geodesicActiveContour->SetFeatureImage( sigmoid->GetOutput() );
-
zeroCrossing->SetInput( geodesicActiveContour->GetOutput() );
//thresholder->SetInput( zeroCrossing->GetOutput() );
thresholder->SetInput( geodesicActiveContour->GetOutput() );
connector2->SetInput( thresholder->GetOutput() );
-
-< - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < -
-*/
-
-
-
-
smoothing->SetTimeStep( 0.125 );
smoothing->SetNumberOfIterations( 5 );
smoothing->SetConductanceParameter( 9.0 );
-
-
- const double sigma = atof( crea::wx2std(sigm).c_str() );
+ const double sigma = atof( crea::wx2std(sigm).c_str() );
gradientMagnitude->SetSigma( sigma );
-
- const double alpha = atof( crea::wx2std(alf).c_str() );
- const double beta = atof( crea::wx2std(bet).c_str() );
-
+ const double alpha = atof( crea::wx2std(alf).c_str() );
+ const double beta = atof( crea::wx2std(bet).c_str() );
sigmoid->SetAlpha( alpha );
sigmoid->SetBeta( beta );
-
typedef FastMarchingFilterType::NodeContainer NodeContainer;
typedef FastMarchingFilterType::NodeType NodeType;
-
NodeContainer::Pointer seeds = NodeContainer::New();
-
InternalImageType::IndexType seedPosition;
- seedPosition[0] = x;
- seedPosition[1] = y;
-
+ seedPosition[0] = x;
+ seedPosition[1] = y;
const double initialDistance = atof( crea::wx2std(distanc).c_str() );
-
NodeType node;
-
const double seedValue = - initialDistance;
-
node.SetValue( seedValue );
node.SetIndex( seedPosition );
-
seeds->Initialize();
seeds->InsertElement( 0, node );
-
fastMarching->SetTrialPoints( seeds );
-
fastMarching->SetSpeedConstant( 1.0 );
-
- fastMarching->SetOutputSize(
- connector->GetOutput()->GetBufferedRegion().GetSize() );
-
+ fastMarching->SetOutputSize( connector->GetOutput()->GetBufferedRegion().GetSize() );
fastMarching->SetStoppingValue( 800 );
try
{
-
- connector2->Update();
- vtkImageData *idata = connector2->GetOutput();
-
- vtkMarchingContourFilter* cntVTK = vtkMarchingContourFilter::New( );
-
- cntVTK->SetNumberOfContours( 1 );
- cntVTK->SetValue( 0, 255 );
+// connector2->Update();
+ vtkImageData *idata = NULL;
+ idata = connector2->GetOutput();
+ vtkMarchingContourFilter* cntVTK = vtkMarchingContourFilter::New( );
+ cntVTK->SetNumberOfContours( 1 );
+ cntVTK->SetValue( 0, 255 );
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
- cntVTK->SetInput( idata );
- cntVTK->Update( );
- cntVTK->UpdateInformation();
+ cntVTK->SetInput( idata );
+ cntVTK->Update( );
+ cntVTK->UpdateInformation();
#else
- cntVTK->SetInputData( idata );
+ cntVTK->SetInputData( idata );
#endif
-
- vtkCleanPolyData* cpd = vtkCleanPolyData::New( );
-
+ vtkCleanPolyData* cpd = vtkCleanPolyData::New( );
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
- cpd->SetInput( cntVTK->GetOutput( ) );
- cpd->Update( );
- cpd->UpdateInformation();
+ cpd->SetInput( cntVTK->GetOutput( ) );
+ cpd->Update( );
+ cpd->UpdateInformation();
#else
- cpd->SetInputData( cntVTK->GetOutput( ) );
+ cpd->SetInputData( cntVTK->GetOutput( ) );
#endif
-
-
- vtkPolyDataConnectivityFilter* conn = vtkPolyDataConnectivityFilter::New( );
- conn->SetExtractionModeToLargestRegion( );
+ vtkPolyDataConnectivityFilter* conn = vtkPolyDataConnectivityFilter::New( );
+ conn->SetExtractionModeToLargestRegion( );
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
- conn->SetInput( cpd->GetOutput( ) );
- conn->Update( );
- conn->UpdateInformation();
+ conn->SetInput( cpd->GetOutput( ) );
+ conn->Update( );
+ conn->UpdateInformation();
#else
- conn->SetInputData( cpd->GetOutput( ) );
+ conn->SetInputData( cpd->GetOutput( ) );
#endif
-
-
- vtkStripper* vtkstripper = vtkStripper::New( );
-
+ vtkStripper* vtkstripper = vtkStripper::New( );
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
- vtkstripper->SetInput( conn->GetOutput() );
- vtkstripper->Update();
- vtkstripper->UpdateInformation();
+ vtkstripper->SetInput( conn->GetOutput() );
+ vtkstripper->Update();
+ vtkstripper->UpdateInformation();
#else
- vtkstripper->SetInputData( conn->GetOutput() );
- cntVTK->Update();
+ vtkstripper->SetInputData( conn->GetOutput() );
+ cntVTK->Update();
#endif
-
- vtkPolyData* polyDataResult = cntVTK->GetOutput();
- //std::cout<<"Points "<<polyDataResult->GetNumberOfPoints()<<std::endl;
+ vtkPolyData* polyDataResult = cntVTK->GetOutput();
+ //std::cout<<"Points "<<polyDataResult->GetNumberOfPoints()<<std::endl;
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
- polyDataResult->Update( );
- polyDataResult->UpdateInformation();
+ polyDataResult->Update( );
+ polyDataResult->UpdateInformation();
#else
// ..
#endif
-
- //EED
- /*
- ofstream myfile;
- myfile.open ("C:/Creatis/example.txt");
- myfile << "\n";
- polyDataResult->Print(myfile);
- myfile << "-------------------------------------\n";
- polyDataResult->GetLines()->Print(myfile);
- myfile.close();*/
-
- cntVTK -> Delete();
- cpd -> Delete();
- conn -> Delete();
-
-
- //--Calculating control points
-
- std::vector<double> vecX;
- std::vector<double> vecY;
- std::vector<double> vecXo;
- std::vector<double> vecYo;
- std::vector<double>::iterator vecXoi;
- std::vector<double>::iterator vecYoi;
- std::vector<double> vecZ;
-
- std::vector<double> vecCtrlPointX;
- std::vector<double> vecCtrlPointY;
- std::vector<double> vecCtrlPointZ;
-
-
- double *p;
- double xAct=0;
- double yAct=0;
- int ii,size=polyDataResult->GetNumberOfPoints();
- ofstream myfile;
- myfile.open ("C:/Creatis/example2.txt");
-
- size=polyDataResult->GetNumberOfPoints();
- for (ii=0;ii<size;ii++)
- {
- if(ii==0)
- {
- xAct=x;
- yAct=y;
- }
- p = polyDataResult->GetPoint(ii);
- double x=p[0];
- double y=p[1];
- /*if(fabs(yAct-y)>20)
+ cntVTK -> Delete();
+ cpd -> Delete();
+ conn -> Delete();
+ //--Calculating control points
+ std::vector<double> vecX;
+ std::vector<double> vecY;
+ std::vector<double> vecXo;
+ std::vector<double> vecYo;
+ std::vector<double>::iterator vecXoi;
+ std::vector<double>::iterator vecYoi;
+ std::vector<double> vecZ;
+ std::vector<double> vecCtrlPointX;
+ std::vector<double> vecCtrlPointY;
+ std::vector<double> vecCtrlPointZ;
+ double *p;
+ double xAct=0;
+ double yAct=0;
+ int ii,size=polyDataResult->GetNumberOfPoints();
+ ofstream myfile;
+ myfile.open ("C:/Creatis/example2.txt");
+ size=polyDataResult->GetNumberOfPoints();
+ for (ii=0;ii<size;ii++)
{
- if((xAct-x)>1 || (xAct-x)<-1)
+ if(ii==0)
{
- vecX.push_back( p[0] );
- vecY.push_back( p[1] );
- myfile <<p[0]<<","<<p[1]<<"\n";
- std::cout<<" x Anterior "<<xAct<<" x actual "<<x<<std::endl;
- std::cout<<" y Anterior "<<yAct<<" y actual "<<y<<std::endl;
- std::cout<<" x "<<p[0]<<" y "<<p[1]<<std::endl;
- vecZ.push_back( 900 );
- xAct=x;
- yAct=y;
+ xAct=x;
+ yAct=y;
}
- else
+ p = polyDataResult->GetPoint(ii);
+ double x=p[0];
+ double y=p[1];
+// if(fabs(yAct-y)>20)
+// {
+// if((xAct-x)>1 || (xAct-x)<-1)
+// {
+// vecX.push_back( p[0] );
+// vecY.push_back( p[1] );
+// myfile <<p[0]<<","<<p[1]<<"\n";
+// std::cout<<" x Anterior "<<xAct<<" x actual "<<x<<std::endl;
+// std::cout<<" y Anterior "<<yAct<<" y actual "<<y<<std::endl;
+// std::cout<<" x "<<p[0]<<" y "<<p[1]<<std::endl;
+// vecZ.push_back( 900 );
+// xAct=x;
+// yAct=y;
+// } else {
+// vecXo.push_back(p[0]);
+// vecYo.push_back(p[1]);
+// }
+// } else
+
+ if(fabs(xAct-x)>11)
{
vecXo.push_back(p[0]);
vecYo.push_back(p[1]);
- }
-
- }
- else*/ if(fabs(xAct-x)>11)
- {
- vecXo.push_back(p[0]);
- vecYo.push_back(p[1]);
- } else {
- vecX.push_back( p[0] );
- myfile <<p[0]<<","<<p[1]<<"\n";
- //std::cout<<" x Anterior "<<xAct<<" x actual "<<x<<std::endl;
- //std::cout<<" y Anterior "<<yAct<<" y actual "<<y<<std::endl;
- //std::cout<<" x "<<p[0]<<" y "<<p[1]<<std::endl;
- vecY.push_back( p[1] );
+ } else {
+ vecX.push_back( p[0] );
+ myfile <<p[0]<<","<<p[1]<<"\n";
+ //std::cout<<" x Anterior "<<xAct<<" x actual "<<x<<std::endl;
+ //std::cout<<" y Anterior "<<yAct<<" y actual "<<y<<std::endl;
+ //std::cout<<" x "<<p[0]<<" y "<<p[1]<<std::endl;
+ vecY.push_back( p[1] );
//EED 2017-12-16
- vecZ.push_back( -900 );
- xAct = x;
- yAct = y;
- } // if xAct
-
+ vecZ.push_back( -900 );
+ xAct = x;
+ yAct = y;
+ } // if xAct
- }
- while(!vecXo.empty())
- {
- vecX.push_back(vecXo.back());
- //std::cout<<" x Siguiente "<<vecXo.back();
- vecXo.pop_back();
-//EED 2017-12-16
- vecZ.push_back( -900 );
- }
- while(!vecYo.empty())
- {
- vecY.push_back(vecYo.back());
- vecYo.pop_back();
- }
- myfile.close();
+ } // for
- /*for(int l=0;l<vecX.size();l++)
- {
- if(l==0)
+ while(!vecXo.empty())
{
- vecXo.push_back(p[0]);
- vecYo.push_back(p[1]);
+ vecX.push_back(vecXo.back());
+ //std::cout<<" x Siguiente "<<vecXo.back();
+ vecXo.pop_back();
+ //EED 2017-12-16
+ vecZ.push_back( -900 );
}
- else
+ while(!vecYo.empty())
{
- if(vecXoi[l-1]==)
- {
- }
+ vecY.push_back(vecYo.back());
+ vecYo.pop_back();
}
+ myfile.close();
+
+// for(int l=0;l<vecX.size();l++)
+// {
+// if(l==0)
+// {
+// vecXo.push_back(p[0]);
+// vecYo.push_back(p[1]);
+// } else {
+// if(vecXoi[l-1]==)
+// {
+// }
+// } // if
+// } // for
+
+ ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
+ extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
+
+ int method=2;
+ if (method==0)
+ {
+ extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+ } else if (method==1){
+ extractcontrolpoints2d->GetControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+ } else if (method==2){
+ extractcontrolpoints2d->SetSamplingControlPoints( 15 );
+ extractcontrolpoints2d->GetSamplingControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+ }
+ //--Adding contour to the system
- }*/
-
- ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
-
- extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
-
- int method=2;
- if (method==0){
- extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
- }
- else if (method==1){
- extractcontrolpoints2d->GetControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
- }
- else if (method==2){
- extractcontrolpoints2d->SetSamplingControlPoints( 15 );
- extractcontrolpoints2d->GetSamplingControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
- }
- //--Adding contour to the system
-
- std::vector<int> actualInstantVector;
- _instantPanel->getInstant( actualInstantVector );
- actualInstantVector[1]=z;
+ std::vector<int> actualInstantVector;
+ _instantPanel->getInstant( actualInstantVector );
+ actualInstantVector[1]=z;
- int j,sizeCtrPt = vecCtrlPointX.size();
+ int j,sizeCtrPt = vecCtrlPointX.size();
- manualBaseModel *manModelContour = kernelManager->factoryManualContourModel( typeofcontour );
- manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
- if (sizeCtrPt>=3){
- for (j=0 ; j<sizeCtrPt ; j++)
- {
- manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j] );
- } // for
- std::string theName;
- //theName = _modelManager->createOutline( manModelContour, actualInstantVector );
- theName = kernelManager->createOutline( manModelContour, actualInstantVector );
- bool addedModel = theName.compare("") != 0;
- if( addedModel )
- {
- double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
- _theViewPanel->getSpacing(spc);
- //Adding the manualContourControler to interface objects structure
- //Adding the manualViewContour to interface objects structure
- //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
- _theViewPanel->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
- //_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
- } // if addedModel
- } // if sizeCtrPt
+ manualBaseModel *manModelContour = kernelManager->factoryManualContourModel( typeofcontour );
+ manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
+ if (sizeCtrPt>=3){
+ for (j=0 ; j<sizeCtrPt ; j++)
+ {
+ manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j] );
+ } // for
+ std::string theName;
+ //theName = _modelManager->createOutline( manModelContour, actualInstantVector );
+ theName = kernelManager->createOutline( manModelContour, actualInstantVector );
+ bool addedModel = theName.compare("") != 0;
+ if( addedModel )
+ {
+ double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+ _theViewPanel->getSpacing(spc);
+ //Adding the manualContourControler to interface objects structure
+ //Adding the manualViewContour to interface objects structure
+ //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+ _theViewPanel->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
+ //_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
+ } // if addedModel
+ } // if sizeCtrPt
+ } catch( itk::ExceptionObject & excep ) {
+ std::cerr << "Exception caught !" << std::endl;
+ std::cerr << excep << std::endl;
+ } // try
-/*
-//EED10JUIN2011
- WriterType::Pointer writer = WriterType::New();
- CastFilterType3::Pointer caster = CastFilterType3::New();
-
- caster->SetInput( gradientMagnitude->GetOutput() );
- writer->SetInput( caster->GetOutput() );
- writer->SetFileName("Gradient Magnitude.png");
- caster->SetOutputMinimum( 0 );
- caster->SetOutputMaximum( 255 );
- writer->Update();
-
- CastFilterType3::Pointer caster2 = CastFilterType3::New();
- WriterType::Pointer writer2 = WriterType::New();
-
- caster2->SetInput( sigmoid->GetOutput() );
- writer2->SetInput( caster2->GetOutput() );
- writer2->SetFileName("Sigmoid.png");
- caster2->SetOutputMinimum( 0 );
- caster2->SetOutputMaximum( 255 );
- writer2->Update();
-
- CastFilterType3::Pointer caster3 = CastFilterType3::New();
- WriterType::Pointer writer3 = WriterType::New();
-
- caster3->SetInput( fastMarching->GetOutput() );
- writer3->SetInput( caster3->GetOutput() );
- writer3->SetFileName("FastMarching.bmp");
- caster3->SetOutputMinimum( 0 );
- caster3->SetOutputMaximum( 255 );
- writer3->Update();
-
- CastFilterType3::Pointer caster4 = CastFilterType3::New();
- WriterType::Pointer writer4 = WriterType::New();
-
- caster4->SetInput( geodesicActiveContour->GetOutput() );
- writer4->SetInput( caster4->GetOutput() );
- writer4->SetFileName("GeodesicActiveContour.png");
- caster4->SetOutputMinimum( 0 );
- caster4->SetOutputMaximum( 255 );
- writer4->Update();
-
- CastFilterType3::Pointer caster5 = CastFilterType3::New();
- WriterType::Pointer writer5 = WriterType::New();
-
- caster5->SetInput( zeroCrossing->GetOutput() );
- writer5->SetInput( caster5->GetOutput() );
- writer5->SetFileName("ZeroCrossing.bmp");
- caster5->SetOutputMinimum( 0 );
- caster5->SetOutputMaximum( 255 );
- writer5->Update();
-*/
- }
- catch( itk::ExceptionObject & excep )
- {
- std::cerr << "Exception caught !" << std::endl;
- std::cerr << excep << std::endl;
- }
}
void wxContourMainFrame::onSegmentationOneSlice(int isovalue,int sampling,int method){
void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method )
{
+
+printf("EED wxContourMainFrame::SegmentationOneSlice Start=%d %d\n",sampling,method );
+printf("EED wxContourMainFrame::SegmentationOneSlice %d %d %d \n",x,y,z );
+
int typeofcontour = 1;
//--Extracting Contour
- //vtkImageData *imagedata = _theViewPanel->getSceneManager()->GetImageData();
vtkImageData *imagedata = getImageData();
-// double *range = imagedata->GetScalarRange();
-// double thr = 1;
vtkImageReslice *imageReslice = vtkImageReslice::New();
//EED
-// double spc[3];
-// imagedata->GetSpacing(spc);
-// x = x*spc[0];
-// y = y*spc[1];
-// z = z*spc[3];
+ double spc[3];
+ imagedata->GetSpacing(spc);
+ x = x*spc[0];
+ y = y*spc[1];
+ z = z;
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
#endif
imageReslice->SetInformationInput(imagedata);
imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
- imageReslice->SetResliceAxesOrigin(0,0,z);
+ imageReslice->SetResliceAxesOrigin(0,0,z*spc[2]);
imageReslice->SetOutputDimensionality(2);
imageReslice->SetInterpolationModeToLinear();
cpd->UpdateInformation();
vtkPolyDataConnectivityFilter* conn = vtkPolyDataConnectivityFilter::New( );
- conn->SetExtractionModeToClosestPointRegion( );
+
+// conn->SetExtractionModeToPointSeededRegions();
+// conn->SetExtractionModeToCellSeededRegions();
+// conn->SetExtractionModeToSpecifiedRegions();
+// conn->SetExtractionModeToLargestRegion();
+// conn->SetExtractionModeToAllRegions();
+
+ conn->SetExtractionModeToClosestPointRegion();
+
//conn->SetMaxRecursionDepth( 3000 );
//EED 2017-01-01 Migration VTK7
cpd2->UpdateInformation();
vtkStripper* vtkstripper = vtkStripper::New( );
+vtkstripper->SetJoinContiguousSegments(true);
+ vtkstripper->SetMaximumLength(20000);
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
vtkstripper->SetInput( cpd2->GetOutput() );
#else
vtkstripper->SetInputData( cpd2->GetOutput() );
+// vtkstripper->SetInputData( cntVTK->GetOutput() );
+
#endif
vtkstripper->Update();
vtkstripper->UpdateInformation();
polyDataResult->GetLines()->Print(myfile);
myfile.close();
*/
-
- cntVTK -> Delete();
- cpd2 -> Delete();
- cpd -> Delete();
- conn -> Delete();
-
+ cntVTK -> Delete();
+ cpd2 -> Delete();
+ cpd -> Delete();
+ conn -> Delete();
//--Calculating control points
-
std::vector<double> vecX;
std::vector<double> vecY;
std::vector<double> vecZ;
-
std::vector<double> vecCtrlPointX;
std::vector<double> vecCtrlPointY;
std::vector<double> vecCtrlPointZ;
+printf("EED wxContourMainFrame::SegmentationOneSlice GetNumberOfLines=%d \n",polyDataResult->GetNumberOfLines() );
- double *p;
- int ii,size=polyDataResult->GetNumberOfPoints();
- int id;
- for (ii=1;ii<=size;ii++)
- {
- id = polyDataResult->GetLines()->GetData()->GetValue(ii);
- p = polyDataResult->GetPoint(id);
-// double x=p[0];
-// double y=p[1];
- vecX.push_back( p[0] );
- vecY.push_back( p[1] );
-//EED 2017-12-16
- vecZ.push_back( -900 );
-// vecZ.push_back( p[2] );
- }
+int numberOfPointsInCell;
+int numberOfcells=polyDataResult->GetNumberOfCells();
+for (int jj=0; jj<numberOfcells ; jj++)
+{
+ vtkCell* vtkcell = polyDataResult->GetCell( jj );
+ numberOfPointsInCell=vtkcell->GetNumberOfPoints();
+ printf("EED wxContourMainFrame::SegmentationOneSlice cell=%d points=%d \n",jj,numberOfPointsInCell );
+}// for jj
+printf("EED wxContourMainFrame::SegmentationOneSlice PrintSelf \n");
- ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
- extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
+polyDataResult->PrintSelf( std::cout, vtkIndent(0) );
-//PROOFS
- /*if (methodRadiobox->GetSelection()==0){
- extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
- }
- if (methodRadiobox->GetSelection()==1){
- extractcontrolpoints2d->GetControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
- }
- if (methodRadiobox->GetSelection()==2){
- extractcontrolpoints2d->SetSamplingControlPoints( sampling );
- extractcontrolpoints2d->GetSamplingControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
- }*/
- if (method==0){
- extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
- }
- else if (method==1){
- extractcontrolpoints2d->GetControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
- }
- else if (method==2){
- extractcontrolpoints2d->SetSamplingControlPoints( sampling );
- extractcontrolpoints2d->GetSamplingControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
- }
+ if (polyDataResult->GetNumberOfCells()>0)
+ {
+ double *p;
+ printf("EED wxContourMainFrame::SegmentationOneSlice A \n");
+ vtkCell* vtkcell = polyDataResult->GetCell( 0 );
+ printf("EED wxContourMainFrame::SegmentationOneSlice B \n");
+ // int ii,size=polyDataResult->GetNumberOfPoints();
+ int ii,size=vtkcell->GetNumberOfPoints();
+ printf("EED wxContourMainFrame::SegmentationOneSlice C \n");
+ int id;
+ for (ii=0;ii<size;ii++)
+ {
+ // id = polyDataResult->GetLines()->GetData()->GetValue(ii);
+ // p = polyDataResult->GetPoint(id);
+ p = vtkcell->GetPoints()->GetPoint(ii);
- //--Adding contour to the system
+ printf("EED wxContourMainFrame::SegmentationOneSlice (%d) id=%d px=%f py=%f\n",ii,id, p[0],p[1]);
+ // double x=p[0];
+ // double y=p[1];
+ vecX.push_back( p[0] );
+ vecY.push_back( p[1] );
+ //EED 2017-12-16
+ vecZ.push_back( -900 );
+ // vecZ.push_back( p[2] );
+ }
+
+ ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
+ extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
- std::vector<int> actualInstantVector;
- _instantPanel->getInstant( actualInstantVector );
- actualInstantVector[1]=z;
+ //PROOFS
+ /*if (methodRadiobox->GetSelection()==0){
+ extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+ }
+ if (methodRadiobox->GetSelection()==1){
+ extractcontrolpoints2d->GetControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+ }
+ if (methodRadiobox->GetSelection()==2){
+ extractcontrolpoints2d->SetSamplingControlPoints( sampling );
+ extractcontrolpoints2d->GetSamplingControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+ }*/
- int j,sizeCtrPt = vecCtrlPointX.size();
- manualBaseModel *manModelContour = kernelManager->factoryManualContourModel( typeofcontour );
- manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
- if (sizeCtrPt>=3){
- for (j=0 ; j<sizeCtrPt ; j++)
+ if (method==0)
{
- manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j] );
- } // for
- std::string theName;
- //theName = _modelManager->createOutline( manModelContour, actualInstantVector );
- theName = kernelManager->createOutline( manModelContour, actualInstantVector );
- bool addedModel = theName.compare("") != 0;
- if( addedModel )
+ extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+ } else if (method==1){
+ extractcontrolpoints2d->GetControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+ } else if (method==2){
+ extractcontrolpoints2d->SetSamplingControlPoints( sampling );
+ extractcontrolpoints2d->GetSamplingControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+ }
+
+ //--Adding contour to the system
+ std::vector<int> actualInstantVector;
+ _instantPanel->getInstant( actualInstantVector );
+ actualInstantVector[1]=z;
+
+ int j,sizeCtrPt = vecCtrlPointX.size();
+ manualBaseModel *manModelContour = kernelManager->factoryManualContourModel( typeofcontour );
+ manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 *2 );
+ manModelContour->SetLabel2( std::to_string(z) );
+ if (sizeCtrPt>=3)
{
- double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
- _theViewPanel->getSpacing(spc);
- //Adding the manualContourControler to interface objects structure
- //Adding the manualViewContour to interface objects structure
- //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
- _theViewPanel->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
- //_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
- } // if addedModel
- } // if sizeCtrPt
+ for (j=0 ; j<sizeCtrPt ; j++)
+ {
+ manModelContour->AddPoint( vecCtrlPointX[j] / spc[0], vecCtrlPointY[j] / spc[1], vecCtrlPointZ[j] );
+ } // for
+ std::string theName;
+ //theName = _modelManager->createOutline( manModelContour, actualInstantVector );
+ theName = kernelManager->createOutline( manModelContour, actualInstantVector );
+ bool addedModel = theName.compare("") != 0;
+ if( addedModel )
+ {
+ double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
+ _theViewPanel->getSpacing(spc);
+ //Adding the manualContourControler to interface objects structure
+ //Adding the manualViewContour to interface objects structure
+ //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
+ _theViewPanel->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
+ //_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
+ } // if addedModel
+ } // if sizeCtrPt
+ } // if NumberOfCells > 0
+
+printf("EED wxContourMainFrame::SegmentationOneSlice End\n");
}
-int wxContourMainFrame::GetImageDataSizeZ(){
+
+int wxContourMainFrame::GetImageDataSizeZ()
+{
return _theViewPanel->GetImageDataSizeZ();
}
-void wxContourMainFrame::GetImageDataRange(double *range){
+void wxContourMainFrame::GetImageDataRange(double *range)
+{
_theViewPanel->GetImageDataRange(range);
}
-void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method){
+void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method)
+{
//JCP 20-10-08 Undo redo implementation
saveState();
//JCP 20-10-08 Undo redo implementation
wxBusyCursor wait;
- int x = _theViewPanel->GetX();
- int y = _theViewPanel->GetY();
- int z;
- double porcent;
- wxString tmpString;
- double totalZ = maxZ-minZ+1;
+ int x = _theViewPanel->GetX();
+ int y = _theViewPanel->GetY();
+ int z;
+ double porcent;
+ wxString tmpString;
+ double totalZ = maxZ-minZ+1;
for( z=minZ ; z<=maxZ ; z++ )
{
porcent = 100.0* (z-minZ)/totalZ;
RefreshInterface();
}
+void wxContourMainFrame::onBeforeAfterContour(bool before,bool after)
+{
+ _theViewPanel->onBeforeAfterContour(before,after);
+ RefreshInterface();
+}
+
+void wxContourMainFrame::onJumpSlice(int step, int shift)
+{
+ std::vector<int> tempVector;
+ _instantPanel->getInstant( tempVector );
+ int ss = abs(step);
+ int pos = tempVector[1];
+ int maxZ = interfMainPanel::getInstance()->GetImageDataSizeZ();
+ pos=(pos/ss)*ss+step+shift;
+ if ((pos>=0) && (pos<maxZ))
+ {
+ tempVector[1]=pos;
+ _instantPanel->setInstant( tempVector );
+ RefreshInterface();
+ } // if pos
+}
+
+void wxContourMainFrame::onShowTextContour(bool show)
+{
+ _theViewPanel->onShowTextContour(show);
+ RefreshInterface();
+}
+
void wxContourMainFrame::onChangeInstant(std::string name,int actual)
{
_instantPanel->setConceptValue( name, actual );
}
-
void wxContourMainFrame::resetAppend()
{
kernelManager->resetAppend();
}
-
void wxContourMainFrame::onSpreadAdd()
{
std::vector<double> vecX;
void wxContourMainFrame::getInstantVector(std::vector<int>& tempVector)
{
+ _instantPanel->getInstant( tempVector );
}
std::vector<std::string> wxContourMainFrame::getOutlinesName(int slide)
valueChInfo->SetInputData(value);
#endif
valueChInfo->SetSpacingScale(spc);
+ valueChInfo->Update();
vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
//EED 2017-01-01 Migration VTK7
maskChInfo->SetInputData(mask);
#endif
maskChInfo->SetSpacingScale(spc);
+ maskChInfo->Update();
vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
//EED 2017-01-01 Migration VTK7
}
-void wxContourMainFrame::saveFileWithContoursAutomatique(){
+void wxContourMainFrame::saveFileWithContoursAutomatique()
+{
+printf("EED wxContourMainFrame::saveFileWithContoursAutomatique \n");
std::string filename = kernelManager->getCurrentFileName();
if(filename.compare("")!=0){
saveFileWithContours(filename);
onSave();
}
}
-void wxContourMainFrame::ShowToolsPanel(bool show){
+void wxContourMainFrame::ShowToolsPanel(bool show)
+{
_pannew->Show(show);
}
return _viewColorLayerImagePanel;
}
+void wxContourMainFrame::SetColorLayerImage(vtkImageData* img)
+{
+ if (_viewColorLayerImagePanel!=NULL)
+ {
+ if (img!=NULL)
+ {
+ _viewColorLayerImagePanel->SetActive(true);
+ _viewColorLayerImagePanel->SetImage( img );
+// RefreshInterface();
+ } // img
+ } // _viewColorLayerImagePanel
+}
wxPanel *wxContourMainFrame::getThresholdImageViewPanel(wxWindow *parent)
{
{
double range[2];
_theViewPanel->getImageData()->GetScalarRange(range);
- int min = (int)floor (range[0]);
- int max = (int)ceil (range[1]);
- int start= (max+min)/2 - (max-min)*0.25;
- int end= (max+min)/2 + (max-min)*0.25;
- _viewThresholdImagePanel = new ThresholdImageViewPanel( parent, min, max, start, end , 1);
- _viewThresholdImage = new ThresholdImageView();
+ int min = (int)floor (range[0]);
+ int max = (int)ceil (range[1]);
+ int start = (max+min)/2 - (max-min)*0.25;
+ int end = (max+min)/2 + (max-min)*0.25;
+ _viewThresholdImagePanel = new ThresholdImageViewPanel( parent, min, max, start, end , 1);
+ _viewThresholdImage = new ThresholdImageView();
_viewThresholdImage->SetminMaxValue(start,end);
+// _viewThresholdImage->SetminMaxValue(range[0],range[1]);
_viewThresholdImage->SetImage( _theViewPanel->getImageData() );
std::vector<int> colorbarposition;
colorbarposition.push_back( 10 );
{
_fileLocation = newFileLocation;
std::cout<<"GETFILELOCATION:"<<_fileLocation<<std::endl;
+
+//EED 2019-12-17
+ kernelManager->setCurrentFileName(_fileLocation);
}
//------------------------------------------------------------------------------------------------------------
sizeLstNameThings = lstNameThings.size();
for (i=0 ; i<sizeLstNameThings ; i++)
{
- printf("EED wxContourMainFrame::FlipAllContours contour=%d \n", i );
manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
if (flipDirection==0)
{
void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection)
{
- printf("EED wxContourMainFrame::FlipContours( %d , %d ) \n",typeContourFlip, flipDirection );
-
saveState();
if (typeContourFlip==0) //
RefreshInterface();
}
+void wxContourMainFrame::SetXY(int x, int y)
+{
+ _theViewPanel->SetXY(x,y);
+}
+wxVtkBaseView* wxContourMainFrame::GetWxVtkBaseView()
+{
+ if (_theViewPanel!=NULL)
+ {
+ return _theViewPanel->getWxVtkBaseView();;
+ } else {
+ return NULL;
+ }
+}
//EED10JUIN2011 #include "itkImageFileWriter.h"
+//EED2020-03-18
+#undef Success
+
#include "itkImageToVTKImageFilter.h"
#include "itkVTKImageToImageFilter.h"
//------------------------------------------------------------------------------------------------------------
class interfMainPanel;
class wxContourMainFrame : public wxPanel {
-
public:
-
//------------------------------------------------------------------------------------------------------------
// Constructors & Destructors
//------------------------------------------------------------------------------------------------------------
-
-
wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,long style = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER);
wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,std::string datadir="C:/Creatis/creaContoursBin/RelWithDebInfo/");
-
~wxContourMainFrame();
-
//------------------------------------------------------------------------------------------------------------
// Creational and initialization methods
//------------------------------------------------------------------------------------------------------------
-
void setVectImages(std::vector<vtkImageData*> imgs);
-
bool configurePanels( );
-
bool addNewPanel(wxPanel* panel);
-
wxAuiNotebook * createNotebook();
-
void createInstantChooserPanel(wxAuiNotebook * parent);
-
void createViewPanel(wxAuiNotebook * parent);
-
void createInstantChooserPanel(wxWindow * parent);
-
void createViewPanel(wxWindow * parent);
-
+ wxVtkBaseView* GetWxVtkBaseView();
void setInstantChooserPanel( wxInstantChooserPanel * theInstantChooserPanel );
-
void getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup, int selection, int minZ, int maxZ);
-
void SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value);
-
void ShowToolsPanel(bool show);
-
-
////------------------------------------------------------------------------------------------------------------
//// Methods for capturing events
////------------------------------------------------------------------------------------------------------------
-
////------------------------------------------------------------------------------------------------------------
//// Model management methods
////------------------------------------------------------------------------------------------------------------
-
//------------------------------------------------------------------------------------------------------------
// Attributes getters and setters
//------------------------------------------------------------------------------------------------------------
int getWindowLevel();
void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
void onInterpolation(bool interpolate);
+ void onShowTextContour(bool show);
+ void onBeforeAfterContour(bool before, bool after);
+ void onJumpSlice(int step,int shift);
void onChangeInstant(std::string name,int actual);
void resetAppend();
void onSpreadAdd();
void SetContourGroup(int contourGroup);
wxPanel *getThresholdImageViewPanel(wxWindow *parent);
wxPanel *getColorLayerImageViewPanel(wxWindow *parent);
+ void SetColorLayerImage(vtkImageData*);
//CMRU 17-08-09-----------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------
void SetScalarRange(int grayRangeMin, int grayRangeMax);
-
std::string GetStringTypeImage( vtkImageData* image);
//------------------------------------------------------------------------------------------------------------
+ void SetXY(int x,int y);
+
+
private:
//------------------------------------------------------------------------------------------------------------
// Private methods
// Attributtes
//------------------------------------------------------------------------------------------------------------
- int _contourGroup;
+ int _contourGroup;
static wxContourMainFrame *instance;
KernelManagerContour *kernelManager;
interfMainPanel *_pannew;
wxAuiManager m_mgr;
wxAuiNotebook *notebook;
- long m_notebook_style;
- long m_notebook_theme;
- int _numberOfVariablesStatistics;
+ long m_notebook_style;
+ long m_notebook_theme;
+ int _numberOfVariablesStatistics;
// Contour Image Mask
ThresholdImageView *_viewMaskImage;
{
theShowingImage->GetSpacing(last_spacing);
showingVID = theShowingImage;
+ _showBeforeContour = false;
+ _showAfterContour = false;
int gapH = 20;
int gapV = 10;
_verticalConceptName = "";
return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ();
}
+ //------------------------------------------------------------------------------------------------------------
+ void wxContourViewPanel::SetXY(int x, int y)
+ {
+ GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetX(x);
+ GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetY(y);
+ }
+
//------------------------------------------------------------------------------------------------------------
void wxContourViewPanel::Refresh()
{
void wxContourViewPanel::addNameWrapperToScene()
{
- int size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
- for(int i = 0; i < size;i++){
+ int i,size = wxContourMainFrame::getInstance()->getNamesWrappingSize();
+ for(i = 0; i < size;i++)
+ {
std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i);
_sceneManager->addToScene(name, true, true, true, false, false );
- }
+ } // for i
+
+ _sceneManager->SetLabelNumberOfContours( "contours:"+std::to_string(size) );
+
+ std::vector<int> tempVector;
+ wxContourMainFrame::getInstance()->getInstantVector( tempVector );
+
+ if (_showBeforeContour==true)
+ {
+ size=0;
+ std::vector<std::string> lstNameBefor;
+ // Contours Befor
+ for (i=tempVector[1]-1; i>=0; i--)
+ {
+ lstNameBefor = wxContourMainFrame::getInstance()->getOutlinesName( i );
+ size = lstNameBefor.size();
+ if (size!=0)
+ {
+ i=-1;
+ } //if size
+ } // for
+ for(i = 0; i < size;i++)
+ {
+ // ctrol active showCtr
+ _sceneManager->addToScene(lstNameBefor[i], true, true, false, false, false );
+ } // for i
+ } // if _before Contour
+
+ if (_showAfterContour==true)
+ {
+ size=0;
+ std::vector<std::string> lstNameAfter;
+ // Contours After
+ int ext[6];
+ getImageData()->GetExtent(ext);
+ int dimZ=ext[5]-ext[4]+1;
+ for (i=tempVector[1]+1; i<dimZ; i++)
+ {
+ lstNameAfter = wxContourMainFrame::getInstance()->getOutlinesName( i );
+ size = lstNameAfter.size();
+ if (size!=0)
+ {
+ i=dimZ;
+ } //if size
+ } // for
+ for(i = 0; i < size;i++)
+ {
+ // ctrol active showCtr
+ _sceneManager->addToScene(lstNameAfter[i], true, true, false, false, false );
+ } // for i
+ } // if _after Contour
}
- std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
+ std::vector<std::string> wxContourViewPanel::getSelectedObjects()
+ {
return _sceneManager->getSelectedObjects();
}
- void wxContourViewPanel::RefreshInterface(){
+ void wxContourViewPanel::RefreshInterface()
+ {
getWxVtkBaseView()->Refresh();
}
- vtkImageData* wxContourViewPanel::getImageData(){
+ vtkImageData* wxContourViewPanel::getImageData()
+ {
return _sceneManager->GetImageData();
}
wxvtk2dbaseview->SetInterpolate( interpolate );
}
+ void wxContourViewPanel::onBeforeAfterContour(bool before, bool after)
+ {
+ _showBeforeContour = before;
+ _showAfterContour = after;
+ }
+
+ void wxContourViewPanel::onShowTextContour(bool show)
+ {
+ _sceneManager->SetShowTextContour( show );
+ }
+
void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
{
_sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
}
- void wxContourViewPanel::setImageSlice(int z){
+ void wxContourViewPanel::setImageSlice(int z)
+ {
vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
baseview->SetActualSlice(z);
* Gets the vertical concept name
* @return _verticalConcept The name of the concept for setting at the vertical bar
*/
- std::string getVerticalConceptName( );
-
+ std::string getVerticalConceptName( );
//------------------------------------------------------------------------------------------------------------
// Other functional methods
//------------------------------------------------------------------------------------------------------------
-
- void getSpacing( double * spacing );
-
- wxVtkBaseView* getWxVtkBaseView();
-
- double getCurrentDeep();
-
- void SetVisibleAxis(bool ok);
- int GetX();
- int GetY();
- int GetZ();
- void Refresh();
+ void getSpacing( double * spacing );
+ wxVtkBaseView* getWxVtkBaseView();
+ double getCurrentDeep();
+ void SetVisibleAxis(bool ok);
+ int GetX();
+ int GetY();
+ int GetZ();
+ void SetXY(int x, int y);
+ void Refresh();
//this method should be deleted
void onStopCreateROI (wxCommandEvent& event);
void onChangedDeep (wxCommandEvent& event);
void onActionButtonPressed(wxCommandEvent& event);
-
void removeSceneContours();
void addNameWrapperToScene();
-
std::vector<std::string> getSelectedObjects();
-
void RefreshInterface();
-
vtkImageData* getImageData();
-
void configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour);
-
- int GetImageDataSizeZ();
-
+ int GetImageDataSizeZ();
void GetImageDataRange(double *range);
-
void SetWidthContour(double width );
-
- int getColorWindow();
-
- int getWindowLevel();
-
+ int getColorWindow();
+ int getWindowLevel();
void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
-
void onInterpolation(bool interpolate);
-
+ void onShowTextContour(bool show);
+ void onBeforeAfterContour(bool before, bool after);
void GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ );
-
void changeImage(vtkImageData* img);
-
void changeDeep();
-
void setImageSlice(int z);
-private:
-
+
+private:
//------------------------------------------------------------------------------------------------------------
// Attributtes
//------------------------------------------------------------------------------------------------------------
bool _useHorizontalBar;
wxEvtHandler *_eventHandler;
+ bool _showBeforeContour;
+ bool _showAfterContour;
//EED
- wxVtkMPR2DView * GetwxVtkMPR2DView();
+ wxVtkMPR2DView *GetwxVtkMPR2DView();
// DECLARE_CLASS(wxContourViewPanel)
//------------------------------------------------------------------------------------------------------------
void setInstant(std::vector<int> choiceInstant);
-
void setInstant(std::map<std::string,int>* _actualInstant );
-
void getInstant(std::vector<int> & choiceInstant);
-
void getInstantData(std::map<std::string,int> & choiceInstantData);
-
std::map<std::string,int>* getInstantData();
-
void setResolutionRangeWithLasUpdate();
-
void refreshConceptLabels();
-
void setConfiguration(std::string aConfiguration);
-
std::string getConfiguration();
-
void setResolutionOverAll( bool condition );
-
bool getIfResolutionOverAll();
-
void setConceptValue( std::string theConceptName, int theValue );
-
int getConceptValue( std::string theConceptName );
-
ConceptDataWrap * getConceptDataOf( std::string theConceptName );
-
bool getIfConceptCheckedAt( std::string theConceptName, int atChecksPosition );
-
void onChangeInstant( wxCommandEvent& event );
-
void addConcepts(std::vector<std::string> conceptNameVect,std::vector<int> conceptSizeVect);
private:
// Private methods
//------------------------------------------------------------------------------------------------------------
void initializeResolutionSlider();
-
void changeResolutionAtConceptControl( wxConceptControl * theConceptToUpdate );
-
void setVerticalMaxSelectedNums( std::string groupMaxVertNums );
//------------------------------------------------------------------------------------------------------------
// Attributtes
//------------------------------------------------------------------------------------------------------------
- std::vector<wxConceptControl *> * _concepts;
-
- wxConceptControl * _lastConceptUpdated;
-
- wxSlider * _resolutionSlider;
-
- wxFlexGridSizer * _outSizer;
-
- bool _orientation;
-
- bool _resolutionOverALL;
-
- std::map<std::string,int>* _actualInstant;
-
- std::vector<int> _verticalMaxSelected;
-
- wxEvtHandler * _eventHandler;
-
- std::string _configuration;
+ std::vector<wxConceptControl *> *_concepts;
+ wxConceptControl *_lastConceptUpdated;
+ wxSlider *_resolutionSlider;
+ wxFlexGridSizer *_outSizer;
+ bool _orientation;
+ bool _resolutionOverALL;
+ std::map<std::string,int> *_actualInstant;
+ std::vector<int> _verticalMaxSelected;
+ wxEvtHandler *_eventHandler;
+ std::string _configuration;
-
//DECLARE_CLASS(wxInstantChooserPanel)
// any class wishing to process wxWindows events must use this macro
//DECLARE_EVENT_TABLE()
-
};
-
#endif
_waiting = false;
_creatingROI = false;
_drawingSelectionROI = false;
+ _showTextContour = true;
SetWidthContour(1.0);
_wxVtk_BaseView = theWxBaseViewToManage;
if( _wxVtk_BaseView!=NULL )
SetVtkInteractorStyleBaseView( theInteractorStyleBaseView );
}
configureSelectionROI( spc );
+ configureTextNumberOfContour();
}
//------------------------------------------------------------------------------------------------------------
manViewerContour->RefreshContour();
addToScene( theKeyName );
}
- //------------------------------------------------------------------------------------------------------------
- void wxVtkBaseView_SceneManager :: configureSelectionROI( double * spc )
- {
+//------------------------------------------------------------------------------------------------------------
+void wxVtkBaseView_SceneManager :: configureSelectionROI( double * spc )
+{
_controlerSelectionROI = new manualRoiControler();
_viewerSelectionROI = new manualViewRoi();
_modelSelectionROI = new manualContourModel();
_controlerSelectionROI->SetModelView( _modelSelectionROI , _viewerSelectionROI );
((vtkInteractorStyleBaseView*)_wxVtk_BaseView->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _controlerSelectionROI );
_controlerSelectionROI->SetActive(false);
- }
+}
- //------------------------------------------------------------------------------------------------------------
- ContourWrap_ViewControl * wxVtkBaseView_SceneManager :: insertWrap( std::string theKeyName, manualContourBaseControler * manContourControl, manualViewBaseContour * manViewerContour )
+//------------------------------------------------------------------------------------------------------------
+void wxVtkBaseView_SceneManager::configureTextNumberOfContour()
+{
+ // Text Window Level
+ vtkTextActor *textActor = vtkTextActor::New();
+ textActor->SetDisplayPosition(10, 85);
+ textActor->SetInput("contours:--");
+ // Set coordinates to match the old vtkScaledTextActor default value
+ textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
+ textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
+ vtkTextProperty *tprop = textActor->GetTextProperty();
+ tprop->SetFontSize(14);
+ tprop->SetFontFamilyToArial();
+ tprop->SetColor(1, 1, 0);
+ _wxVtk_BaseView->GetRenderer()->AddActor2D(textActor);
+ _numberOfContoursTextActor=textActor;
+}
+
+//------------------------------------------------------------------------------------------------------------
+void wxVtkBaseView_SceneManager::SetLabelNumberOfContours( std::string label )
+{
+ _numberOfContoursTextActor->SetInput( label.c_str() );
+}
+
+//------------------------------------------------------------------------------------------------------------
+ContourWrap_ViewControl * wxVtkBaseView_SceneManager :: insertWrap( std::string theKeyName, manualContourBaseControler * manContourControl, manualViewBaseContour * manViewerContour )
{
ContourWrap_ViewControl * newContourWrap = new ContourWrap_ViewControl(manContourControl, manViewerContour);
if(_contours_ViewControl == NULL)
if( !append )
{
removeSceneContours();
- }
+ } // if !append
+
_sceneContours_ViewControl->insert(std::pair <std::string, ContourWrap_ViewControl *> ( theKeyName, contourWRP ) );
- if ( visualization )
+
+ if ( visualization==true )
{
contourWRP->getViewer()->AddCompleteContourActor( ifShowCtrlPoints );
- }
+ } // if visualization
- if( control )
+ if( control==true )
{
((vtkInteractorStyleBaseView*)_wxVtk_BaseView->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( contourWRP->getControler() );
- }
- if( ifActive )
+ } // if contour
+
+ if( !control )
+ {
+ contourWRP->getViewer()->SetColorNormalContour(1,0,0);
+ } else {
+ contourWRP->getViewer()->SetColorNormalContour(0,0,1);
+ } // if !contour
+
+ if( ifActive==true )
{
contourWRP->getControler()->SetActive( true );
contourWRP->getViewer()->RemoveTextActor();
- }
+ } // if ifActive
+
+ contourWRP->getViewer()->SetShowText(_showTextContour);
}
//------------------------------------------------------------------------------------------------------------
} // if
}
+ void wxVtkBaseView_SceneManager::SetShowTextContour(bool show)
+ {
+ _showTextContour = show;
+ }
+
bool wxVtkBaseView_SceneManager::isEditableCControler(std::string theKeyName){
ContourWrap_ViewControl* ccon = getContourWrap_ViewControlOf(theKeyName);
// Methods for capturing events
//------------------------------------------------------------------------------------------------------------
-
//------------------------------------------------------------------------------------------------------------
// Methods for sending events
//------------------------------------------------------------------------------------------------------------
int GetImageDataSizeZ();
void GetImageDataRange( double *range );
void SetWidthContour(double width);
+ void SetShowTextContour(bool show);
//JCP 21 - 09 - 08
bool isEditableCControler(std::string theKeyName);
bool isCtrlPressed();
bool isShiftPressed();
char getLastKeyCode();
+ void SetLabelNumberOfContours( std::string label );
+
private:
//------------------------------------------------------------------------------------------------------------
// Private methods
//------------------------------------------------------------------------------------------------------------
+ void configureTextNumberOfContour();
//------------------------------------------------------------------------------------------------------------
double _widthOfControlPoint;
bool _ctrlKey;
bool _shiftKey;
+ bool _showTextContour;
+ vtkTextActor *_numberOfContoursTextActor;
};
#endif // __wxVtkBaseView_SceneManager_HEADER_FILE__
change->SetInputData(img);
#endif
img->GetSpacing(spc);
- change->SetOutputSpacing(1,1,1);
+// change->SetOutputSpacing(1,1,1);
//EED 18 fev 2014
change->SetOutputOrigin (0, 0, 0);
change->Update();