1 #include "bbTransform3DdicomMetaImageReader_DicomInfo.h"
2 #include "bbTransform3DdicomPackage.h"
3 namespace bbTransform3Ddicom
6 BBTK_ADD_BLACK_BOX_TO_PACKAGE(Transform3Ddicom,MetaImageReader_DicomInfo)
7 BBTK_BLACK_BOX_IMPLEMENTATION(MetaImageReader_DicomInfo,bbtk::AtomicBlackBox);
8 void MetaImageReader_DicomInfo::Process()
10 if (bbGetInputIn()!=""){
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) );
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) );
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) );
48 bbSetOutputIPP( IPP );
49 bbSetOutputIOP( IPP );
50 bbSetOutputPixelSpacing( PixelSpacing );
57 void MetaImageReader_DicomInfo::bbUserConstructor()
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
71 PixelSpacing.push_back( 1 );
72 PixelSpacing.push_back( 1 );
73 PixelSpacing.push_back( 1 );
77 void MetaImageReader_DicomInfo::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
81 void MetaImageReader_DicomInfo::bbUserDestructor()
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)
90 void MetaImageReader_DicomInfo::bbUserSetDefaultValues()
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
103 PixelSpacing.clear();
104 PixelSpacing.push_back( 1 );
105 PixelSpacing.push_back( 1 );
106 PixelSpacing.push_back( 1 );
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)
114 void MetaImageReader_DicomInfo::bbUserInitializeProcessing()
117 // THE INITIALIZATION METHOD BODY :
119 // but this is where you should allocate the internal/output pointers
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)
126 void MetaImageReader_DicomInfo::bbUserFinalizeProcessing()
129 // THE FINALIZATION METHOD BODY :
131 // but this is where you should desallocate the internal/output pointers
140 // EO namespace bbTransform3Ddicom