From: Eduardo DAVILA Date: Tue, 2 Jun 2020 16:28:15 +0000 (+0200) Subject: #3437creaVtkFeatureNewNormalConnectivity Filter (s) box and LstOfVoxels box X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b684dcec05f633447cda0247d81ba730f14b5617;p=creaVtk.git #3437creaVtkFeatureNewNormalConnectivity Filter (s) box and LstOfVoxels box --- diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageConnectivityFilter.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageConnectivityFilter.cxx new file mode 100644 index 0000000..69faac2 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageConnectivityFilter.cxx @@ -0,0 +1,101 @@ +//===== +// 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 "bbcreaVtkImageConnectivityFilter.h" +#include "bbcreaVtkPackage.h" + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageConnectivityFilter) +BBTK_BLACK_BOX_IMPLEMENTATION(ImageConnectivityFilter,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 ImageConnectivityFilter::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') + + + if (bbGetInputIn()!=NULL){ + if (imgConnfilter) {imgConnfilter->Delete();} + imgConnfilter=vtkImageConnectivityFilter::New(); + imgConnfilter->SetInputData( bbGetInputIn() ); + if (bbGetInputExtractionMode()==0) // LargestRegion + { + imgConnfilter->SetExtractionModeToLargestRegion(); + } // ExtractionMode + + if (bbGetInputExtractionMode()==1) // AllRegions + { + printf("EED Warning!!!! ImageConnectivityFilter - AllRegions Not Implemented\n "); + } // ExtractionMode + if (bbGetInputExtractionMode()==2) // SeededRegions + { + printf("EED Warning!!!! ImageConnectivityFilter - SeededRegions Not Implemented\n "); + } // ExtractionMode + + if (bbGetInputScalarRange().size()==2) + { + imgConnfilter->SetScalarRange( bbGetInputScalarRange()[0], bbGetInputScalarRange()[1] ); + } // Range + imgConnfilter->Update(); + bbSetOutputOut( imgConnfilter->GetOutput() ); + } else { + printf("EED Warning!!!! ImageConnectivityFilter - Input image not defined.\n "); + }// In + +} +//===== +// 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 ImageConnectivityFilter::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputIn(NULL); +// bbSetInputScalarRange(); + imgConnfilter=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 ImageConnectivityFilter::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 ImageConnectivityFilter::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbcreaVtk + + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageConnectivityFilter.h b/bbtk_creaVtk_PKG/src/bbcreaVtkImageConnectivityFilter.h new file mode 100644 index 0000000..bec7295 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageConnectivityFilter.h @@ -0,0 +1,59 @@ +//===== +// 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 __bbcreaVtkImageConnectivityFilter_h_INCLUDED__ +#define __bbcreaVtkImageConnectivityFilter_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include +#include + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT ImageConnectivityFilter + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(ImageConnectivityFilter,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(In,vtkImageData*); + BBTK_DECLARE_INPUT(ExtractionMode,int); + BBTK_DECLARE_INPUT(ScalarRange,std::vector< double >); + + BBTK_DECLARE_OUTPUT(Out,vtkImageData*); + BBTK_PROCESS(Process); + void Process(); + + vtkImageConnectivityFilter* imgConnfilter; +//===== +// 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(ImageConnectivityFilter,bbtk::AtomicBlackBox); + BBTK_NAME("ImageConnectivityFilter"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(ImageConnectivityFilter,In,"Input image",vtkImageData*,""); + BBTK_INPUT(ImageConnectivityFilter,ExtractionMode,"(default 0) 0=LargestRegion 1=AllRegions 2=SeededRegions",int,""); + BBTK_INPUT(ImageConnectivityFilter,ScalarRange,"threshold [Min Max]",std::vector< double >,""); + + BBTK_OUTPUT(ImageConnectivityFilter,Out,"Output image",vtkImageData*,""); + +BBTK_END_DESCRIBE_BLACK_BOX(ImageConnectivityFilter); +//===== +// 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 bbcreaVtk + +#endif // __bbcreaVtkImageConnectivityFilter_h_INCLUDED__ + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.cxx new file mode 100644 index 0000000..7136643 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.cxx @@ -0,0 +1,74 @@ +//===== +// 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 "bbcreaVtkImageThresholdConnectivity.h" +#include "bbcreaVtkPackage.h" +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageThresholdConnectivity) +BBTK_BLACK_BOX_IMPLEMENTATION(ImageThresholdConnectivity,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 ImageThresholdConnectivity::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') + + + printf("EED ImageThresholdConnectivity::Process Error this box is not implemented .... \n"); + printf("EED ImageThresholdConnectivity::Process Error this box is not implemented .... \n"); + printf("EED ImageThresholdConnectivity::Process Error this box is not implemented .... \n"); + printf("EED ImageThresholdConnectivity::Process Error this box is not implemented .... \n"); +} +//===== +// 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 ImageThresholdConnectivity::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 ImageThresholdConnectivity::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 ImageThresholdConnectivity::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbcreaVtk + + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.h b/bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.h new file mode 100644 index 0000000..a629e1c --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageThresholdConnectivity.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 __bbcreaVtkImageThresholdConnectivity_h_INCLUDED__ +#define __bbcreaVtkImageThresholdConnectivity_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include +#include + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT ImageThresholdConnectivity + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(ImageThresholdConnectivity,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(In,vtkImageData*); + BBTK_DECLARE_OUTPUT(Out,vtkImageData*); + 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(ImageThresholdConnectivity,bbtk::AtomicBlackBox); + BBTK_NAME("ImageThresholdConnectivity"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("vtkImageThresholdConnectivity"); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(ImageThresholdConnectivity,In,"Input image",vtkImageData*,""); + + BBTK_OUTPUT(ImageThresholdConnectivity,Out,"Output image",vtkImageData*,""); + +BBTK_END_DESCRIBE_BLACK_BOX(ImageThresholdConnectivity); +//===== +// 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 bbcreaVtk + +#endif // __bbcreaVtkImageThresholdConnectivity_h_INCLUDED__ + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkLstOfVoxels.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkLstOfVoxels.cxx new file mode 100644 index 0000000..b3f257e --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkLstOfVoxels.cxx @@ -0,0 +1,139 @@ +//===== +// 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 "bbcreaVtkLstOfVoxels.h" +#include "bbcreaVtkPackage.h" + +#include "creaVtk_MACROS.h" + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,LstOfVoxels) +BBTK_BLACK_BOX_IMPLEMENTATION(LstOfVoxels,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 LstOfVoxels::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') + + if (bbGetInputIn()!=NULL) + { + DEF_POINTER_IMAGE_VTK_CREA(vIn,ssIn,pIn,stIn,bbGetInputIn()) \ + std::vector lstX; + std::vector lstY; + std::vector lstZ; + std::vector lstValues; + int ext[6]; + bbGetInputIn()->GetExtent(ext); + int dim[3]; + dim[0]=ext[1]-ext[0]+1; + dim[1]=ext[3]-ext[2]+1; + dim[2]=ext[5]-ext[4]+1; + int i,j,k; + long int index=0; + + + int rangeType=0; + if (bbGetInputRange().size()==2) + { + rangeType=1; + } + bool addPoint; + + + for (k=0 ; k=bbGetInputRange()[0]) && (vIn<=bbGetInputRange()[1]) ) + { + addPoint=true; + } // if vIn ==0 + } // if rangeType + + + if (addPoint==true) + { + lstX.push_back(i); + lstY.push_back(j); + lstZ.push_back(k); + lstValues.push_back(vIn); + } // if vIn ==0 + + index++; + } // for i + } // for j + } // for k + bbSetOutputLstX( lstX ); + bbSetOutputLstY( lstY ); + bbSetOutputLstZ( lstZ ); + bbSetOutputLstValues( lstValues ); + } else { + printf("EED Warning!! LstOfVoxels image not set.\n"); + }// In + +} +//===== +// 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 LstOfVoxels::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 LstOfVoxels::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 LstOfVoxels::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbcreaVtk + + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkLstOfVoxels.h b/bbtk_creaVtk_PKG/src/bbcreaVtkLstOfVoxels.h new file mode 100644 index 0000000..f534caa --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkLstOfVoxels.h @@ -0,0 +1,57 @@ +//===== +// 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 __bbcreaVtkLstOfVoxels_h_INCLUDED__ +#define __bbcreaVtkLstOfVoxels_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vector" +#include "vtkImageData.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT LstOfVoxels + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(LstOfVoxels,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(In,vtkImageData*); + BBTK_DECLARE_INPUT(Range,std::vector); + BBTK_DECLARE_OUTPUT(LstX,std::vector); + BBTK_DECLARE_OUTPUT(LstY,std::vector); + BBTK_DECLARE_OUTPUT(LstZ,std::vector); + BBTK_DECLARE_OUTPUT(LstValues,std::vector); + 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(LstOfVoxels,bbtk::AtomicBlackBox); + BBTK_NAME("LstOfVoxels"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + BBTK_INPUT(LstOfVoxels,In,"Input image",vtkImageData*,""); + BBTK_INPUT(LstOfVoxels,Range,"Threshold [Min Max]",std::vector,""); + BBTK_OUTPUT(LstOfVoxels,LstX,"List of x points",std::vector,""); + BBTK_OUTPUT(LstOfVoxels,LstY,"List of y points",std::vector,""); + BBTK_OUTPUT(LstOfVoxels,LstZ,"List of z points",std::vector,""); + BBTK_OUTPUT(LstOfVoxels,LstValues,"List of z points",std::vector,""); +BBTK_END_DESCRIBE_BLACK_BOX(LstOfVoxels); +//===== +// 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 bbcreaVtk + +#endif // __bbcreaVtkLstOfVoxels_h_INCLUDED__ +