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
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);
33 v_iop.push_back(iop[i]);
34 bbSetOutputIOP(v_iop );
36 std::vector<double> v_ipp;
38 f->GetImagePositionPatient(ipp);
40 v_ipp.push_back(ipp[i]);
41 bbSetOutputIPP(v_ipp );
44 // Add all the files to the SerieHelper
45 sh = GDCM_NAME_SPACE::SerieHelper::New();
46 std::vector<std::string> gii = bbGetInputIn();
47 for(std::vector<std::string>::iterator it = gii.begin();
54 GDCM_NAME_SPACE::FileList::const_iterator it;
55 GDCM_NAME_SPACE::FileList *l;
57 // Should only contain one!
58 l = sh->GetFirstSingleSerieUIDFileSet();
64 zspacing = sh->GetZSpacing();
66 std::vector<double> v_pixelspacing;
67 v_pixelspacing.push_back( f->GetXSpacing() );
68 v_pixelspacing.push_back( f->GetYSpacing() );
69 v_pixelspacing.push_back( zspacing );
70 // if (f->GetZSize() != 1) {
71 // v_pixelspacing.push_back(f->GetZSpacing());
73 bbSetOutputPixelSpacing(v_pixelspacing);
78 reader = vtkGdcmReader::New();
79 //reader->SetFileName( bbGetInputIn().c_str() );
80 reader->SetCoherentFileList(l);
84 bbSetOutputOut( reader->GetOutput() );
87 void GetXCoherentInfoGdcmReader::bbUserConstructor()
89 std::vector<std::string> init;
94 void GetXCoherentInfoGdcmReader::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
99 void GetXCoherentInfoGdcmReader::bbUserDestructor()
110 // EO namespace bbgdcmvtk