]> Creatis software - creaImageIO.git/blob - bbtk_Transform3Ddicom_PKG/src/bbTransform3DdicomFlipImage.cxx
#3328 ViewerPlaneContourDicom3D.bbg
[creaImageIO.git] / bbtk_Transform3Ddicom_PKG / src / bbTransform3DdicomFlipImage.cxx
1 #include "bbTransform3DdicomFlipImage.h"
2 #include "bbTransform3DdicomPackage.h"
3 namespace bbTransform3Ddicom
4 {
5
6 BBTK_ADD_BLACK_BOX_TO_PACKAGE(Transform3Ddicom,FlipImage)
7 BBTK_BLACK_BOX_IMPLEMENTATION(FlipImage,bbtk::AtomicBlackBox);
8
9 void FlipImage::Process()
10 {
11         if (imagedata!=NULL)
12         {
13                 imagedata->Delete();
14         }
15         imagedata = vtkImageData::New();
16         imagedata->DeepCopy( bbGetInputIn() );
17         
18         int ext[6];
19         imagedata->GetExtent( ext );
20         
21         for (int z=0; z<=ext[5]; z++) {
22           for (int x=0; x<ext[1]; x++) {
23                 for (int y=0; y<ext[3]/2; y++) {
24                         unsigned short *p1 = (unsigned short *)imagedata->GetScalarPointer( x , y , z ); 
25                         unsigned short *p2 = (unsigned short *)imagedata->GetScalarPointer( x , ext[3]-y-1 , z ); 
26                         unsigned short tt;
27                         tt =*p1;
28                         *p1=*p2;
29                         *p2=tt;
30                 }
31           } 
32         }
33
34         bbSetOutputOut( imagedata );
35 }
36
37 /*  EED 13/11/2015
38 void FlipImage::bbUserConstructor()
39 {
40         imagedata=NULL;
41 //    bbSetInputIn(0);
42 }
43
44 void FlipImage::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
45 {
46 }
47
48 void FlipImage::bbUserDestructor()
49 {  
50 }
51 */
52
53
54
55 //===== 
56 // 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)
57 //===== 
58 void FlipImage::bbUserSetDefaultValues()
59 {
60         imagedata=NULL;
61 //    bbSetInputIn(0);
62  
63 }
64
65
66
67
68 //===== 
69 // 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)
70 //===== 
71 void FlipImage::bbUserInitializeProcessing()
72 {
73
74 //  THE INITIALIZATION METHOD BODY :
75 //    Here does nothing 
76 //    but this is where you should allocate the internal/output pointers 
77 //    if any 
78
79   
80 }
81 //===== 
82 // 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)
83 //===== 
84 void FlipImage::bbUserFinalizeProcessing()
85 {
86
87 //  THE FINALIZATION METHOD BODY :
88 //    Here does nothing 
89 //    but this is where you should desallocate the internal/output pointers 
90 //    if any
91   
92 }
93
94
95
96 }
97 // EO namespace bbTransform3Ddicom
98
99