From: Eduardo Davila Date: Thu, 16 Jun 2011 19:18:47 +0000 (+0000) Subject: no message X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=3e4be9b8f2fa5c7c102722328bc4bab99eb2a5ce;p=bbtk.git no message --- diff --git a/packages/vtk/src/bbvtkImageProperties.cxx b/packages/vtk/src/bbvtkImageProperties.cxx new file mode 100644 index 0000000..f21bd70 --- /dev/null +++ b/packages/vtk/src/bbvtkImageProperties.cxx @@ -0,0 +1,119 @@ +//===== +// 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 "bbvtkImageProperties.h" +#include "bbvtkPackage.h" +namespace bbvtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,ImageProperties) +BBTK_BLACK_BOX_IMPLEMENTATION(ImageProperties,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 ImageProperties::Process() +{ + unsigned int dim; + int ext[6]; + double spc[3]; + double range[2]; + std::string nametype; + int numberoOfComponents; + std::vector vsize; + std::vector vspacing; + std::vector vrange; + + if ( bbGetInputIn() ){ + bbGetInputIn()->Update(); + + bbGetInputIn()->GetWholeExtent(ext); + vsize.push_back(ext[1]-ext[0]+1); + vsize.push_back(ext[3]-ext[2]+1); + vsize.push_back(ext[5]-ext[4]+1); + + dim = 0; + if (vsize[0]>1) dim++; + if (vsize[1]>1) dim++; + if (vsize[2]>1) dim++; + + bbGetInputIn()->GetScalarRange(range); + numberoOfComponents=bbGetInputIn()->GetNumberOfScalarComponents(); + + bbGetInputIn()->GetSpacing(spc); + for (unsigned int i=0;iGetScalarType()==VTK_BIT) nametype="VTK_BIT"; + if (bbGetInputIn()->GetScalarType()==VTK_CHAR) nametype="VTK_CHAR"; + if (bbGetInputIn()->GetScalarType()==VTK_SIGNED_CHAR) nametype="VTK_SIGNED_CHAR"; + if (bbGetInputIn()->GetScalarType()==VTK_UNSIGNED_CHAR) nametype="VTK_UNSIGNED_CHAR"; + if (bbGetInputIn()->GetScalarType()==VTK_UNSIGNED_SHORT) nametype="VTK_UNSIGNED_SHORT"; + if (bbGetInputIn()->GetScalarType()==VTK_UNSIGNED_INT) nametype="VTK_UNSIGNED_INT"; + if (bbGetInputIn()->GetScalarType()==VTK_LONG) nametype="VTK_LONG"; + if (bbGetInputIn()->GetScalarType()==VTK_UNSIGNED_LONG) nametype="VTK_UNSIGNED_LONG"; + if (bbGetInputIn()->GetScalarType()==VTK_FLOAT) nametype="VTK_FLOAT"; + if (bbGetInputIn()->GetScalarType()==VTK_DOUBLE) nametype="VTK_DOUBLE"; + } else { + dim = 0; + numberoOfComponents = 0; + vsize.push_back(0); + vsize.push_back(0); + vsize.push_back(0); + vspacing.push_back(0); + vspacing.push_back(0); + vspacing.push_back(0); + vrange.push_back(0); + vrange.push_back(0); + nametype = "VOID"; + } + bbSetOutputDimension( dim ); + bbSetOutputSize( vsize ); + bbSetOutputSpacing( vspacing ); + bbSetOutputMinMax( vrange ); + bbSetOutputTypeName( nametype ); + bbSetOutputComponents( numberoOfComponents ); + +} +//===== +// 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 ImageProperties::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 ImageProperties::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 ImageProperties::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbvtk + + diff --git a/packages/vtk/src/bbvtkImageProperties.h b/packages/vtk/src/bbvtkImageProperties.h new file mode 100644 index 0000000..dfdefe0 --- /dev/null +++ b/packages/vtk/src/bbvtkImageProperties.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 __bbvtkImageProperties_h_INCLUDED__ +#define __bbvtkImageProperties_h_INCLUDED__ +#include "bbvtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" +#include + + +namespace bbvtk +{ + +class bbvtk_EXPORT ImageProperties + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(ImageProperties,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(Dimension,unsigned int); + BBTK_DECLARE_OUTPUT(MinMax,std::vector); + BBTK_DECLARE_OUTPUT(Size,std::vector); + BBTK_DECLARE_OUTPUT(Spacing,std::vector); + BBTK_DECLARE_OUTPUT(TypeName,std::string); + BBTK_DECLARE_OUTPUT(Components,int); + 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(ImageProperties,bbtk::AtomicBlackBox); + BBTK_NAME("ImageProperties"); + BBTK_AUTHOR("Info-Dev Creatis"); + BBTK_DESCRIPTION("Image information Dim, Spc, Type, MinMax"); + BBTK_CATEGORY("filter"); + BBTK_INPUT(ImageProperties,In,"Input image (vtk)",vtkImageData*,""); + BBTK_OUTPUT(ImageProperties,Dimension,"Dimensions 1D 2D 3D",unsigned int,""); + BBTK_OUTPUT(ImageProperties,MinMax,"Gray level range min and max",std::vector,""); + BBTK_OUTPUT(ImageProperties,Size,"Size of the image",std::vector,""); + BBTK_OUTPUT(ImageProperties,Spacing,"Spacing of the image",std::vector,""); + BBTK_OUTPUT(ImageProperties,TypeName,"Type format of the image",std::string,""); + BBTK_OUTPUT(ImageProperties,Components,"Number of scalar components",int,""); +BBTK_END_DESCRIBE_BLACK_BOX(ImageProperties); +//===== +// 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 bbvtk + +#endif // __bbvtkImageProperties_h_INCLUDED__ +