]> Creatis software - creaImageIO.git/blob - bbtk_Transform3Ddicom_PKG/src/bbTransform3DdicomMetaImageReader_DicomInfo.cxx
#3326 bbtk_Transform3Ddicom_PKG
[creaImageIO.git] / bbtk_Transform3Ddicom_PKG / src / bbTransform3DdicomMetaImageReader_DicomInfo.cxx
1 #include "bbTransform3DdicomMetaImageReader_DicomInfo.h"
2 #include "bbTransform3DdicomPackage.h"
3 namespace bbTransform3Ddicom
4 {
5
6 BBTK_ADD_BLACK_BOX_TO_PACKAGE(Transform3Ddicom,MetaImageReader_DicomInfo)
7 BBTK_BLACK_BOX_IMPLEMENTATION(MetaImageReader_DicomInfo,bbtk::AtomicBlackBox);
8 void MetaImageReader_DicomInfo::Process()
9 {  
10         if (bbGetInputIn()!=""){
11                 IPP.clear();
12                 IOP.clear();
13                 PixelSpacing.clear();
14                 char tmp[100];
15                 FILE *ff = fopen(  bbGetInputIn().c_str() , "r+" );
16                 fscanf(ff,"%s", tmp);  // ImagePositionPatient
17                 fscanf(ff,"%s", tmp);  // x
18                 IPP.push_back( atof(tmp) );
19                 fscanf(ff,"%s", tmp);  // y
20                 IPP.push_back( atof(tmp) );
21                 fscanf(ff,"%s", tmp);  // z
22                 IPP.push_back( atof(tmp) );
23
24                 fscanf(ff,"%s", tmp);  // ImageOrientationPatient
25                 fscanf(ff,"%s", tmp);  // x1
26                 IOP.push_back( atof(tmp) );
27                 fscanf(ff,"%s", tmp);  // y1
28                 IOP.push_back( atof(tmp) );
29                 fscanf(ff,"%s", tmp);  // z1
30                 IOP.push_back( atof(tmp) );
31                 fscanf(ff,"%s", tmp);  // x2
32                 IOP.push_back( atof(tmp) );
33                 fscanf(ff,"%s", tmp);  // y2
34                 IOP.push_back( atof(tmp) );
35                 fscanf(ff,"%s", tmp);  // z2
36                 IOP.push_back( atof(tmp) );
37         
38                 fscanf(ff,"%s", tmp);  // Spacing
39                 fscanf(ff,"%s", tmp);  // sx
40                 PixelSpacing.push_back( atof(tmp) );
41                 fscanf(ff,"%s", tmp);  // sy
42                 PixelSpacing.push_back( atof(tmp) );
43                 fscanf(ff,"%s", tmp);  // sz
44                 PixelSpacing.push_back( atof(tmp) );
45                 
46                 fclose(ff);
47                 
48                 bbSetOutputIPP( IPP );
49                 bbSetOutputIOP( IPP );
50                 bbSetOutputPixelSpacing( PixelSpacing );
51         } 
52         
53         
54 }
55         
56 /*
57 void MetaImageReader_DicomInfo::bbUserConstructor()
58 {
59     bbSetInputIn("");
60         IPP.clear();
61         
62         IOP.clear();
63         IOP.push_back( 1 ); // x1
64         IOP.push_back( 0 ); // y1
65         IOP.push_back( 0 ); // z1
66         IOP.push_back( 0 ); // x2
67         IOP.push_back(10 ); // y2
68         IOP.push_back( 0 ); // z2
69         
70         PixelSpacing.clear();
71         PixelSpacing.push_back( 1 );
72         PixelSpacing.push_back( 1 );
73         PixelSpacing.push_back( 1 );
74         
75 }
76         
77 void MetaImageReader_DicomInfo::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
78 {
79 }
80         
81 void MetaImageReader_DicomInfo::bbUserDestructor()
82 {
83 }
84 */
85
86
87 //===== 
88 // 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)
89 //===== 
90 void MetaImageReader_DicomInfo::bbUserSetDefaultValues()
91 {
92     bbSetInputIn("");
93         IPP.clear();
94         
95         IOP.clear();
96         IOP.push_back( 1 ); // x1
97         IOP.push_back( 0 ); // y1
98         IOP.push_back( 0 ); // z1
99         IOP.push_back( 0 ); // x2
100         IOP.push_back(10 ); // y2
101         IOP.push_back( 0 ); // z2
102         
103         PixelSpacing.clear();
104         PixelSpacing.push_back( 1 );
105         PixelSpacing.push_back( 1 );
106         PixelSpacing.push_back( 1 );    
107 }
108
109
110
111 //===== 
112 // 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)
113 //===== 
114 void MetaImageReader_DicomInfo::bbUserInitializeProcessing()
115 {
116
117 //  THE INITIALIZATION METHOD BODY :
118 //    Here does nothing 
119 //    but this is where you should allocate the internal/output pointers 
120 //    if any 
121
122 }
123 //===== 
124 // 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)
125 //===== 
126 void MetaImageReader_DicomInfo::bbUserFinalizeProcessing()
127 {
128
129 //  THE FINALIZATION METHOD BODY :
130 //    Here does nothing 
131 //    but this is where you should desallocate the internal/output pointers 
132 //    if any
133
134   
135 }
136
137
138         
139 }
140 // EO namespace bbTransform3Ddicom
141
142