From 4ee406d321c47d50610d9951f3a97fa56844ba46 Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Tue, 17 Jun 2025 15:13:11 +0200 Subject: [PATCH] #3400 nDimensions for JavaScript --- bbtk/src/bbCreaContournDimensions.h | 2 +- bbtk/src/bbcreaContoursOnSave.cxx | 24 +++++--------- .../bbcreaContourswxContourMainFrame_tool.cxx | 33 ++++++++++++++++--- .../bbcreaContourswxContourMainFrame_tool.h | 29 +++++++++++----- 4 files changed, 59 insertions(+), 29 deletions(-) diff --git a/bbtk/src/bbCreaContournDimensions.h b/bbtk/src/bbCreaContournDimensions.h index dbd6e6e..0080cd1 100644 --- a/bbtk/src/bbCreaContournDimensions.h +++ b/bbtk/src/bbCreaContournDimensions.h @@ -75,7 +75,7 @@ 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_DESCRIPTION("(C++) 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*,""); diff --git a/bbtk/src/bbcreaContoursOnSave.cxx b/bbtk/src/bbcreaContoursOnSave.cxx index b067e6e..67f999c 100644 --- a/bbtk/src/bbcreaContoursOnSave.cxx +++ b/bbtk/src/bbcreaContoursOnSave.cxx @@ -32,8 +32,6 @@ void OnSave::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <GetFileLocation().empty()==false ) @@ -42,43 +40,39 @@ void OnSave::Process() } // 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 - - +// 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 + +}// EO namespace bbcreaContours diff --git a/bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx b/bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx index ae33330..e71eb2a 100644 --- a/bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx +++ b/bbtk/src/bbcreaContourswxContourMainFrame_tool.cxx @@ -4,8 +4,6 @@ #include "bbcreaContourswxContourMainFrame_tool.h" #include "bbcreaContoursPackage.h" -#include "wxContourMainFrame.h" - namespace bbcreaContours { @@ -16,7 +14,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(wxContourMainFrame_tool,bbtk::AtomicBlackBox); //===== void wxContourMainFrame_tool::Process() { - printf("EED wxContourMainFrame_tool::Process start type=%d \n", bbGetInputType() ); // THE MAIN PROCESSING METHOD BODY // Here we simply set the input 'In' value to the output 'Out' // And print out the output value @@ -89,9 +86,34 @@ void wxContourMainFrame_tool::Process() { wxContourMainFrame::getInstance()->ResetCamera(); } // Type 3 + + // OnSave + if (bbGetInputType()==4) + { + if (wxContourMainFrame::getInstance()!=NULL) + { + if ( wxContourMainFrame::getInstance()->GetFileLocation().empty()==false ) + { + wxContourMainFrame::getInstance()->onSave(); + } // if FileLocation + } // if getInstance + } // Type 4 + + // OnRead + if (bbGetInputType()==5) + { + // Todo.... implementd in JavaScript + } // Type 5 + + // GetContours + if (bbGetInputType()==6) + { + // Todo.... implementd in JavaScript + } // Type 6 + + + } // if wxContourMainFrame::getInstance()!=NULL - - printf("EED wxContourMainFrame_tool::Process end\n" ); } //===== @@ -103,6 +125,7 @@ void wxContourMainFrame_tool::bbUserSetDefaultValues() // Here we initialize the input 'In' to 0 bbSetInputType(0); bbSetInputImage(NULL); + bbSetInputwxContourMainFrame(NULL); } //===== diff --git a/bbtk/src/bbcreaContourswxContourMainFrame_tool.h b/bbtk/src/bbcreaContourswxContourMainFrame_tool.h index ceb5410..87fc72f 100644 --- a/bbtk/src/bbcreaContourswxContourMainFrame_tool.h +++ b/bbtk/src/bbcreaContourswxContourMainFrame_tool.h @@ -9,6 +9,7 @@ #include "iostream" #include "vtkImageData.h" +#include "wxContourMainFrame.h" namespace bbcreaContours { @@ -21,10 +22,16 @@ class bbcreaContours_EXPORT wxContourMainFrame_tool //===== // 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( Type , int ); - BBTK_DECLARE_INPUT( Param1, std::vector ); - BBTK_DECLARE_INPUT( Image , vtkImageData* ); - BBTK_DECLARE_OUTPUT( Out , std::vector ); + BBTK_DECLARE_INPUT( Type , int ); + BBTK_DECLARE_INPUT( Param1 , std::vector ); + BBTK_DECLARE_INPUT( Param2 , std::vector ); + BBTK_DECLARE_INPUT( Image , vtkImageData* ); + BBTK_DECLARE_INPUT( wxContourMainFrame, wxContourMainFrame* ); + BBTK_DECLARE_OUTPUT( Out , std::vector ); + BBTK_DECLARE_OUTPUT( LstIndexs , std::vector ); + BBTK_DECLARE_OUTPUT( LstControlPointsX, std::vector ); + BBTK_DECLARE_OUTPUT( LstControlPointsY, std::vector ); + BBTK_DECLARE_OUTPUT( LstControlPointsZ, std::vector ); // BBTK_DECLARE_OUTPUT(Out,double); BBTK_PROCESS(Process); @@ -37,12 +44,18 @@ class bbcreaContours_EXPORT wxContourMainFrame_tool BBTK_BEGIN_DESCRIBE_BLACK_BOX(wxContourMainFrame_tool,bbtk::AtomicBlackBox); BBTK_NAME("wxContourMainFrame_tool"); BBTK_AUTHOR("InfoDev"); - BBTK_DESCRIPTION("No Description."); + BBTK_DESCRIPTION("(C++,JavaScript) (type4 in JavaScript) No Description."); BBTK_CATEGORY("empty"); - BBTK_INPUT(wxContourMainFrame_tool,Type,"(default 0) Type 0:nothing 1:Isovalue segmentation of Image 2:Isovalue segmentation actual slice, 3:Reset Camera ",int,""); - BBTK_INPUT(wxContourMainFrame_tool,Param1,"List of parameters Type1:[step,isovalue,sampling,method,x,y,min,max] Replace all old contours Type2:[isovalue,sampling,method,iSlice,x,y] Replace acutal slice ", std::vector,""); + BBTK_INPUT(wxContourMainFrame_tool,Type,"(default 0) Type 0:nothing 1:Isovalue segmentation of Image, 2:Isovalue segmentation actual slice, 3:Reset Camera, 4:OnSave, 5:OnRead (JavaScript) 6:GetContours (JavaScript)",int,""); + BBTK_INPUT(wxContourMainFrame_tool,Param1,"List of parameters (vector double) Type1:[step,isovalue,sampling,method,x,y,min,max] Replace all old contours Type2:[isovalue,sampling,method,iSlice,x,y] Replace acutal slice ", std::vector,""); + BBTK_INPUT(wxContourMainFrame_tool,Param2,"List of parameters (vector string) Type 4:Filename (JavaScript) Type 5:FileName (JavaScript) ", std::vector,""); BBTK_INPUT(wxContourMainFrame_tool,Image,"Image", vtkImageData*,""); - BBTK_OUTPUT(wxContourMainFrame_tool,Out,"Type 4: Position of viewer ", std::vector,""); + BBTK_INPUT(wxContourMainFrame_tool, wxContourMainFrame, "wxContourMainFrame (used in JavaScript)", wxContourMainFrame*, ""); + BBTK_OUTPUT(wxContourMainFrame_tool,Out," ", std::vector,""); + BBTK_OUTPUT(wxContourMainFrame_tool,LstIndexs," ", std::vector,""); + BBTK_OUTPUT(wxContourMainFrame_tool,LstControlPointsX," ", std::vector,""); + BBTK_OUTPUT(wxContourMainFrame_tool,LstControlPointsY," ", std::vector,""); + BBTK_OUTPUT(wxContourMainFrame_tool,LstControlPointsZ," ", std::vector,""); BBTK_END_DESCRIBE_BLACK_BOX(wxContourMainFrame_tool); //===== // 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) -- 2.50.0