]> Creatis software - creaImageIO.git/blobdiff - bbtk_Transform3Ddicom_PKG/src/bbTransform3DdicomCreateAxesTreeData.cxx
#3326 bbtk_Transform3Ddicom_PKG
[creaImageIO.git] / bbtk_Transform3Ddicom_PKG / src / bbTransform3DdicomCreateAxesTreeData.cxx
diff --git a/bbtk_Transform3Ddicom_PKG/src/bbTransform3DdicomCreateAxesTreeData.cxx b/bbtk_Transform3Ddicom_PKG/src/bbTransform3DdicomCreateAxesTreeData.cxx
new file mode 100644 (file)
index 0000000..0887b1c
--- /dev/null
@@ -0,0 +1,140 @@
+//===== 
+// 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 "bbTransform3DdicomCreateAxesTreeData.h"
+#include "bbTransform3DdicomPackage.h"
+#include "math.h"
+
+namespace bbTransform3Ddicom
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(Transform3Ddicom,CreateAxesTreeData)
+BBTK_BLACK_BOX_IMPLEMENTATION(CreateAxesTreeData,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 CreateAxesTreeData::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')
+
+//    bbSetOutputOut( bbGetInputIn() );
+//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+       std::vector<double> LstX;
+       std::vector<double> LstY;
+       std::vector<double> LstZ;
+       std::vector<int>        LstIndex;
+       std::vector<double> LstColor;
+       if ((bbGetInputIPP().size()==3) && (bbGetInputIOP().size()==6) )
+       {
+       // Axis X
+               LstX.push_back( bbGetInputIPP()[0] );
+               LstY.push_back( bbGetInputIPP()[1] );
+               LstZ.push_back( bbGetInputIPP()[2] );
+               LstX.push_back( bbGetInputIPP()[0]+20 );
+               LstY.push_back( bbGetInputIPP()[1] );
+               LstZ.push_back( bbGetInputIPP()[2] );           
+               LstIndex.push_back(2);
+               LstColor.push_back(1);
+               LstColor.push_back(0);
+               LstColor.push_back(0);
+       // Axis Y
+               LstX.push_back( bbGetInputIPP()[0] );
+               LstY.push_back( bbGetInputIPP()[1] );
+               LstZ.push_back( bbGetInputIPP()[2] );
+               LstX.push_back( bbGetInputIPP()[0] );
+               LstY.push_back( bbGetInputIPP()[1]+20 );
+               LstZ.push_back( bbGetInputIPP()[2] );           
+               LstIndex.push_back(2);
+               LstColor.push_back(1);
+               LstColor.push_back(1);
+               LstColor.push_back(0);
+       // Axis Z
+               LstX.push_back( bbGetInputIPP()[0] );
+               LstY.push_back( bbGetInputIPP()[1] );
+               LstZ.push_back( bbGetInputIPP()[2] );
+               LstX.push_back( bbGetInputIPP()[0] );
+               LstY.push_back( bbGetInputIPP()[1] );
+               LstZ.push_back( bbGetInputIPP()[2]+20 );                
+               LstIndex.push_back(2);
+               LstColor.push_back(1);
+               LstColor.push_back(0);
+               LstColor.push_back(1);
+       // Axis V1
+               LstX.push_back( bbGetInputIPP()[0] );
+               LstY.push_back( bbGetInputIPP()[1] );
+               LstZ.push_back( bbGetInputIPP()[2] );
+               double sizeX = (bbGetInputImageSize()[0]-1)*bbGetInputImageSpacing()[0];
+               LstX.push_back( bbGetInputIPP()[0] + bbGetInputIOP()[0]*sizeX);
+               LstY.push_back( bbGetInputIPP()[1] + bbGetInputIOP()[1]*sizeX);
+               LstZ.push_back( bbGetInputIPP()[2] + bbGetInputIOP()[2]*sizeX);         
+               LstIndex.push_back(2);
+               LstColor.push_back(1);
+               LstColor.push_back(1);
+               LstColor.push_back(1);
+       // Axis V2
+               LstX.push_back( bbGetInputIPP()[0] );
+               LstY.push_back( bbGetInputIPP()[1] );
+               LstZ.push_back( bbGetInputIPP()[2] );
+               double sizeY = (bbGetInputImageSize()[1]-1)*bbGetInputImageSpacing()[1];
+               LstX.push_back( bbGetInputIPP()[0] + bbGetInputIOP()[3]*sizeY);
+               LstY.push_back( bbGetInputIPP()[1] + bbGetInputIOP()[4]*sizeY);
+               LstZ.push_back( bbGetInputIPP()[2] + bbGetInputIOP()[5]*sizeY);         
+               LstIndex.push_back(2);
+               LstColor.push_back(0.7);
+               LstColor.push_back(0.7);
+               LstColor.push_back(0.7);
+     //  ---------------
+               bbSetOutputLstX( LstX );
+               bbSetOutputLstY( LstY );
+               bbSetOutputLstZ( LstZ );
+               bbSetOutputLstIndex( LstIndex );
+               bbSetOutputLstColor( LstColor );
+       }
+}
+//===== 
+// 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 CreateAxesTreeData::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 CreateAxesTreeData::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 CreateAxesTreeData::bbUserFinalizeProcessing()
+{
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any 
+}
+
+} // EO namespace bbTransform3Ddicom
+
+