]> Creatis software - creaImageIO.git/blobdiff - bbtk_Transform3Ddicom_PKG/src/bbTransform3DdicomFlipImage.cxx
#3326 bbtk_Transform3Ddicom_PKG
[creaImageIO.git] / bbtk_Transform3Ddicom_PKG / src / bbTransform3DdicomFlipImage.cxx
diff --git a/bbtk_Transform3Ddicom_PKG/src/bbTransform3DdicomFlipImage.cxx b/bbtk_Transform3Ddicom_PKG/src/bbTransform3DdicomFlipImage.cxx
new file mode 100644 (file)
index 0000000..b88f86f
--- /dev/null
@@ -0,0 +1,99 @@
+#include "bbTransform3DdicomFlipImage.h"
+#include "bbTransform3DdicomPackage.h"
+namespace bbTransform3Ddicom
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(Transform3Ddicom,FlipImage)
+BBTK_BLACK_BOX_IMPLEMENTATION(FlipImage,bbtk::AtomicBlackBox);
+
+void FlipImage::Process()
+{
+       if (imagedata!=NULL)
+       {
+               imagedata->Delete();
+       }
+       imagedata = vtkImageData::New();
+       imagedata->DeepCopy( bbGetInputIn() );
+       
+       int ext[6];
+       imagedata->GetExtent( ext );
+       
+       for (int z=0; z<=ext[5]; z++) {
+         for (int x=0; x<ext[1]; x++) {
+               for (int y=0; y<ext[3]/2; y++) {
+                       unsigned short *p1 = (unsigned short *)imagedata->GetScalarPointer( x , y , z ); 
+                       unsigned short *p2 = (unsigned short *)imagedata->GetScalarPointer( x , ext[3]-y-1 , z ); 
+                       unsigned short tt;
+                       tt =*p1;
+                       *p1=*p2;
+                       *p2=tt;
+               }
+         } 
+       }
+
+       bbSetOutputOut( imagedata );
+}
+
+/*  EED 13/11/2015
+void FlipImage::bbUserConstructor()
+{
+       imagedata=NULL;
+//    bbSetInputIn(0);
+}
+
+void FlipImage::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
+{
+}
+
+void FlipImage::bbUserDestructor()
+{  
+}
+*/
+
+
+
+//===== 
+// 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 FlipImage::bbUserSetDefaultValues()
+{
+       imagedata=NULL;
+//    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 FlipImage::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 FlipImage::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+
+
+
+}
+// EO namespace bbTransform3Ddicom
+
+