From 95ea4de5ed48b8ab8663e94e8f3e95380741ad75 Mon Sep 17 00:00:00 2001 From: trillos Date: Wed, 4 Nov 2009 15:14:35 +0000 Subject: [PATCH] Added Image Recalage Properties --- .../src/bbPackRecalageCalculateVectorBox.cxx | 12 +++-- .../src/bbPackRecalageCalculateVectorBox.h | 9 +++- .../bbPackRecalageImageRecalageProperties.cxx | 51 +++++++++++++++++++ .../bbPackRecalageImageRecalageProperties.h | 42 +++++++++++++++ 4 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 PackRecalage/src/bbPackRecalageImageRecalageProperties.cxx create mode 100644 PackRecalage/src/bbPackRecalageImageRecalageProperties.h 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__ + -- 2.45.0