From: trillos Date: Wed, 4 Nov 2009 15:14:35 +0000 (+0000) Subject: Added Image Recalage Properties X-Git-Tag: CREATOOLS.2-0-3~32 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=95ea4de5ed48b8ab8663e94e8f3e95380741ad75;p=creaRigidRegistration.git Added Image Recalage Properties --- diff --git a/PackRecalage/src/bbPackRecalageCalculateVectorBox.cxx b/PackRecalage/src/bbPackRecalageCalculateVectorBox.cxx index 675e176..8cc5484 100644 --- a/PackRecalage/src/bbPackRecalageCalculateVectorBox.cxx +++ b/PackRecalage/src/bbPackRecalageCalculateVectorBox.cxx @@ -13,11 +13,15 @@ void CalculateVectorBox::Process() if(!bbGetInputPointsX1().empty() && !bbGetInputPointsX2().empty()) { - _vector->SetData(bbGetInputPointsX1(), bbGetInputPointsX2(), bbGetInputPointsY1(), bbGetInputPointsY2(), bbGetInputPointsZ1(), bbGetInputPointsZ2()); - _vector->Run(); + //Checks that all the vector points are defined + if(bbGetInputPointsX1()[1] != NULL && bbGetInputPointsX2()[1] != NULL) + { + _vector->SetData(bbGetInputPointsX1(), bbGetInputPointsX2(), bbGetInputPointsY1(), bbGetInputPointsY2(), bbGetInputPointsZ1(), bbGetInputPointsZ2()); + _vector->Run(); - bbSetOutputOrigin(_vector->GetOrigin()); - bbSetOutputOriginReslicer(_vector->GetOriginReslicer()); + bbSetOutputOrigin(_vector->GetOrigin()); + bbSetOutputOriginReslicer(_vector->GetOriginReslicer()); + } } } void CalculateVectorBox::bbUserSetDefaultValues() diff --git a/PackRecalage/src/bbPackRecalageCalculateVectorBox.h b/PackRecalage/src/bbPackRecalageCalculateVectorBox.h index 3108605..0e0a8de 100644 --- a/PackRecalage/src/bbPackRecalageCalculateVectorBox.h +++ b/PackRecalage/src/bbPackRecalageCalculateVectorBox.h @@ -48,15 +48,22 @@ class bbPackRecalage_EXPORT CalculateVectorBox /*The rotation axis (this axis is defined by the cross product of the 2 vectors)*/ BBTK_DECLARE_OUTPUT(TransformAxis, std::vector); - + /*Scale difference in X*/ BBTK_DECLARE_OUTPUT(OutScaleX,int); + + /*Scale difference in Y*/ BBTK_DECLARE_OUTPUT(OutScaleY,int); + + /*Scale difference in Z*/ BBTK_DECLARE_OUTPUT(OutScaleZ,int); + + /*Rotation Angle*/ BBTK_DECLARE_OUTPUT(OutAngle,double); BBTK_PROCESS(Process); void Process(); private: + VectorMath *_vector; }; diff --git a/PackRecalage/src/bbPackRecalageImageRecalageProperties.cxx b/PackRecalage/src/bbPackRecalageImageRecalageProperties.cxx new file mode 100644 index 0000000..a5781fc --- /dev/null +++ b/PackRecalage/src/bbPackRecalageImageRecalageProperties.cxx @@ -0,0 +1,51 @@ +#include "bbPackRecalageImageRecalageProperties.h" +#include "bbPackRecalagePackage.h" +namespace bbPackRecalage +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,ImageRecalageProperties) +BBTK_BLACK_BOX_IMPLEMENTATION(ImageRecalageProperties,bbtk::AtomicBlackBox); +void ImageRecalageProperties::Process() +{ + image = bbGetInputIn(); + if(image != NULL) + { + bbSetOutputLengthZ((int)image->GetDimensions()[2] - 1); + if(image->GetScalarType() == VTK_DOUBLE) + { + bbSetOutputColorLevel(50); + bbSetOutputMidColorLevel(25); + } + else if(image->GetScalarType() == VTK_UNSIGNED_SHORT) + { + bbSetOutputColorLevel(25000); + bbSetOutputMidColorLevel(12500); + } + else + { + bbSetOutputColorLevel(500); + bbSetOutputMidColorLevel(250); + } + } +} +void ImageRecalageProperties::bbUserSetDefaultValues() +{ + bbSetInputIn(NULL); + image = NULL; +} +void ImageRecalageProperties::bbUserInitializeProcessing() +{ + +// THE INITIALIZATION METHOD BODY : +// Here does nothing +// but this is where you should allocate the internal/output pointers +// if any + + +} +void ImageRecalageProperties::bbUserFinalizeProcessing() +{ + image->Delete(); +} +} +// EO namespace bbPackRecalage \ No newline at end of file diff --git a/PackRecalage/src/bbPackRecalageImageRecalageProperties.h b/PackRecalage/src/bbPackRecalageImageRecalageProperties.h new file mode 100644 index 0000000..6ac78c5 --- /dev/null +++ b/PackRecalage/src/bbPackRecalageImageRecalageProperties.h @@ -0,0 +1,42 @@ +#ifndef __bbPackRecalageImageRecalageProperties_h_INCLUDED__ +#define __bbPackRecalageImageRecalageProperties_h_INCLUDED__ +#include "bbPackRecalage_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkImageData.h" + +namespace bbPackRecalage +{ + +class bbPackRecalage_EXPORT ImageRecalageProperties + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(ImageRecalageProperties,bbtk::AtomicBlackBox); + BBTK_DECLARE_INPUT(In,vtkImageData*); + BBTK_DECLARE_OUTPUT(LengthZ,int); + BBTK_DECLARE_OUTPUT(ColorLevel,int); + BBTK_DECLARE_OUTPUT(MidColorLevel,int); + BBTK_PROCESS(Process); + void Process(); + + private: + vtkImageData *image; +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageRecalageProperties,bbtk::AtomicBlackBox); +BBTK_NAME("ImageRecalageProperties"); +BBTK_AUTHOR("jn.trillos44@uniandes.edu.co"); +BBTK_DESCRIPTION("Finds image properties necessary for image registration."); +BBTK_CATEGORY("image"); +BBTK_INPUT(ImageRecalageProperties,In,"Image",vtkImageData*,""); +BBTK_OUTPUT(ImageRecalageProperties,LengthZ,"Lenght in Z",int,""); +BBTK_OUTPUT(ImageRecalageProperties,ColorLevel,"ColorLevel/WindowLevel range of the Image",int,""); +BBTK_OUTPUT(ImageRecalageProperties,MidColorLevel,"Medium value of the ColorLevel/WindowLevel range of the Image",int,""); +BBTK_END_DESCRIBE_BLACK_BOX(ImageRecalageProperties); +} +// EO namespace bbPackRecalage + +#endif // __bbPackRecalageImageRecalageProperties_h_INCLUDED__ +