From: Eduardo DAVILA Date: Wed, 4 Dec 2019 16:23:10 +0000 (+0100) Subject: #3321 creaContours Feature New Normal - Connection with bbtk X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9c3e9dac7175adc08659330ec8b10233b467bd2d;p=creaContours.git #3321 creaContours Feature New Normal - Connection with bbtk --- diff --git a/bbtk/src/bbCreaContournDimensions.cxx b/bbtk/src/bbCreaContournDimensions.cxx index d0a4504..251d4ff 100644 --- a/bbtk/src/bbCreaContournDimensions.cxx +++ b/bbtk/src/bbCreaContournDimensions.cxx @@ -34,7 +34,6 @@ BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,nDimensions) BBTK_BLACK_BOX_IMPLEMENTATION(nDimensions,bbtk::WxBlackBox); void nDimensions::Process() { -printf("EED nDimensions::Process Start \n" ); double **vectx = 0, **vecty = 0, **vectz = 0; std::vector< void * > vectortemp; @@ -49,34 +48,26 @@ printf("EED nDimensions::Process Start \n" ); wxContourMainFrame::getInstance()->ShowToolsPanel(true); currentimg=img; selectedimages.push_back(img); -printf("EED nDimensions::Process 1 \n" ); wxContourMainFrame::getInstance()->setVectImages(selectedimages); -printf("EED nDimensions::Process 2 \n" ); - } + } // if img if(currentimg != NULL) { int contourtype = bbGetInputContourType(); //wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size); //wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype); - } + } // if currentimg wxContourMainFrame::getInstance()->RefreshInterface(); -printf("EED nDimensions::Process 3.1 \n" ); + bbSetOutputwxContourMainFrame( wxContourMainFrame::getInstance() ); // bbSetOutputX(vectx); -printf("EED nDimensions::Process 3.2 \n" ); // bbSetOutputY(vecty); -printf("EED nDimensions::Process 3.3 \n" ); // bbSetOutputZ(vectz); -printf("EED nDimensions::Process 3.4 \n" ); // bbSetOutputSizeContour(size); -printf("EED nDimensions::Process 3.5 \n" ); // bbSetOutputMask(*mask); -printf("EED nDimensions::Process 3.6 \n" ); // bbSetOutputValue(*value); -printf("EED nDimensions::Process End \n" ); } //----------------------------------------------------------------- @@ -110,17 +101,13 @@ printf("EED WARNING Verify that GetDllAppPath in nDimensions::CreateWidget bbCr #endif // MACOSX -printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() ); +//printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() ); wxContourMainFrame* wxcontourmainframe = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir ); -printf("EED nDimensions::CreateWidget 1 \n" ); wxContourMainFrame::getInstance()->ShowToolsPanel(false); -printf("EED nDimensions::CreateWidget 2 \n" ); // bbSetOutputWidget( new wxPanel(parent,-1) ); bbSetOutputWidget( wxcontourmainframe ); - -printf("EED nDimensions::CreateWidget 3 \n" ); } //----------------------------------------------------------------- diff --git a/bbtk/src/bbCreaContournDimensions.h b/bbtk/src/bbCreaContournDimensions.h index a4f6178..a5f7013 100644 --- a/bbtk/src/bbCreaContournDimensions.h +++ b/bbtk/src/bbCreaContournDimensions.h @@ -63,6 +63,8 @@ class /*BBTK_EXPORT*/ nDimensions BBTK_DECLARE_OUTPUT(Y,double**); BBTK_DECLARE_OUTPUT(Z,double**); BBTK_DECLARE_OUTPUT(SizeContour,std::vector ); + BBTK_DECLARE_OUTPUT(wxContourMainFrame,wxContourMainFrame*); + private: //wxContourMainFrame* frame; @@ -71,20 +73,21 @@ private: }; 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,"(default 0) 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 , ""); + 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 , ""); + BBTK_OUTPUT(nDimensions, wxContourMainFrame, "wxContourMainFrame", wxContourMainFrame*, ""); BBTK_END_DESCRIBE_BLACK_BOX(nDimensions); } diff --git a/bbtk/src/bbcreaContoursSetViewerPosition.cxx b/bbtk/src/bbcreaContoursSetViewerPosition.cxx new file mode 100644 index 0000000..67c824e --- /dev/null +++ b/bbtk/src/bbcreaContoursSetViewerPosition.cxx @@ -0,0 +1,94 @@ +//===== +// 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 = " <getImageData(); + int ext[6]; + img->GetExtent(ext); + int dimY=ext[3]-ext[2]+1; + + bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", y ); + bbGetInputwxContourMainFrame()->SetXY(x,dimY-z-1); + + bbGetInputwxContourMainFrame()->showAxis(true); + bbGetInputwxContourMainFrame()->changeInstant(); + bbGetInputwxContourMainFrame()->RefreshInterface(); + } + } + +} +//===== +// 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 + bbSetInputwxContourMainFrame(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 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 + + diff --git a/bbtk/src/bbcreaContoursSetViewerPosition.h b/bbtk/src/bbcreaContoursSetViewerPosition.h new file mode 100644 index 0000000..d279eda --- /dev/null +++ b/bbtk/src/bbcreaContoursSetViewerPosition.h @@ -0,0 +1,52 @@ +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +#ifndef __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); +// 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(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,""); + + //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__ + diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index a3f199a..e55f284 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -725,13 +725,14 @@ void wxContourMainFrame::updateInstantImageData() _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() @@ -3513,6 +3514,11 @@ void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection) } +void wxContourMainFrame::SetXY(int x, int y) +{ + _theViewPanel->SetXY(x,y); +} + diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index d944563..d752f4a 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -343,6 +343,9 @@ class wxContourMainFrame : public wxPanel { //------------------------------------------------------------------------------------------------------------ + void SetXY(int x,int y); + + private: //------------------------------------------------------------------------------------------------------------ // Private methods diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx index 0115b33..1da23fc 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx @@ -224,6 +224,13 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE ) return GetwxVtkMPR2DView()->GetVtkmprbasedata()->GetZ(); } + //------------------------------------------------------------------------------------------------------------ + void wxContourViewPanel::SetXY(int x, int y) + { + GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetX(x); + GetwxVtkMPR2DView()->GetVtkmprbasedata()->SetY(y); + } + //------------------------------------------------------------------------------------------------------------ void wxContourViewPanel::Refresh() { diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h index 60d66f2..5901157 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h @@ -295,6 +295,7 @@ class wxContourViewPanel : public wxPanel int GetX(); int GetY(); int GetZ(); + void SetXY(int x, int y); void Refresh(); @@ -345,6 +346,8 @@ class wxContourViewPanel : public wxPanel void changeDeep(); void setImageSlice(int z); + + private: //------------------------------------------------------------------------------------------------------------