]> Creatis software - creaRigidRegistration.git/commitdiff
Added Image Recalage Properties
authortrillos <trillos>
Wed, 4 Nov 2009 15:14:35 +0000 (15:14 +0000)
committertrillos <trillos>
Wed, 4 Nov 2009 15:14:35 +0000 (15:14 +0000)
PackRecalage/src/bbPackRecalageCalculateVectorBox.cxx
PackRecalage/src/bbPackRecalageCalculateVectorBox.h
PackRecalage/src/bbPackRecalageImageRecalageProperties.cxx [new file with mode: 0644]
PackRecalage/src/bbPackRecalageImageRecalageProperties.h [new file with mode: 0644]

index 675e176a14624f56b943eba1e408657427e2f967..8cc5484470554dc5940f181cf4a0295a471cea26 100644 (file)
@@ -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()
index 31086052ae920a897e1a49c9a60baae515ed344f..0e0a8deb95cf61e6b894ec01a955c63c38a80113 100644 (file)
@@ -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<double>);
 
-  
+  /*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 (file)
index 0000000..a5781fc
--- /dev/null
@@ -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 (file)
index 0000000..6ac78c5
--- /dev/null
@@ -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__
+