1 #include "bbgdcmvtkGetXCoherentInfoGdcmReader.h"
2 #include "bbgdcmvtkPackage.h"
5 #include "gdcmFileHelper.h"
6 #include "vtkImageData.h"
7 #include "vtkGdcmReader.h"
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(gdcmvtk,GetXCoherentInfoGdcmReader)
14 BBTK_BLACK_BOX_IMPLEMENTATION(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox);
15 void GetXCoherentInfoGdcmReader::Process()
17 // Read the *first* image file (a SET of file names is given as input)
18 f = GDCM_NAME_SPACE::File::New();
19 f->SetFileName( bbGetInputIn()[0] );
27 // Get info from the first image file
29 std::vector<double> v_iop;
31 f->GetImageOrientationPatient(iop);
34 v_iop.push_back(iop[i]);
35 bbSetOutputIOP(v_iop );
37 std::vector<double> v_ipp;
39 f->GetImagePositionPatient(ipp);
42 v_ipp.push_back(ipp[i]);
43 bbSetOutputIPP(v_ipp );
45 // Add *all the files* to the SerieHelper
46 sh = GDCM_NAME_SPACE::SerieHelper::New();
47 std::vector<std::string> gii = bbGetInputIn();
49 for(std::vector<std::string>::iterator it = gii.begin();
56 GDCM_NAME_SPACE::FileList::const_iterator it;
57 GDCM_NAME_SPACE::FileList *l;
59 // Should only contain one!
60 l = sh->GetFirstSingleSerieUIDFileSet();
65 sh->OrderFileList(l); // this one should compute the *actual* Z Spacing!
66 zspacing = sh->GetZSpacing();
67 std::vector<double> v_pixelspacing;
68 v_pixelspacing.push_back( f->GetXSpacing() );
69 v_pixelspacing.push_back( f->GetYSpacing() );
70 v_pixelspacing.push_back( zspacing );
71 // if (f->GetZSize() != 1) {
72 // v_pixelspacing.push_back(f->GetZSpacing());
74 bbSetOutputPixelSpacing(v_pixelspacing);
81 reader = vtkGdcmReader::New();
82 //reader->SetFileName( bbGetInputIn().c_str() );
83 reader->SetCoherentFileList(l);
87 bbSetOutputOut( reader->GetOutput() );
90 void GetXCoherentInfoGdcmReader::bbUserSetDefaultValues()
92 std::vector<std::string> init;
98 void GetXCoherentInfoGdcmReader::bbUserInitializeProcessing()
103 void GetXCoherentInfoGdcmReader::bbUserFinalizeProcessing()
114 // EO namespace bbgdcmvtk