#include <creaImageIOSystem.h>
#include "boost/filesystem.hpp"
+#include <gdcmSerieHelper.h> // JPR
+#include <gdcmFile.h> // JPR
+#include <vtkGdcmReader.h> // JPR
+#include <gdcmDebug.h>
+
namespace fs = boost::filesystem;
namespace creaImageIO
public:
ImageExtent(const std::string& x, const std::string& y, const std::string& z, const std::string& t)
{
- sscanf(x.c_str(),"%d",&mExtent[0]);
- sscanf(y.c_str(),"%d",&mExtent[1]);
- sscanf(z.c_str(),"%d",&mExtent[2]);
- sscanf(t.c_str(),"%d",&mExtent[3]);
- if(x==""){mExtent[0]=1;}
- if(y==""){mExtent[1]=1;}
- if(z==""){mExtent[2]=1;}
- if(t==""){mExtent[3]=1;}
-
- if (mExtent[3]>1) mDim=4;
- else if (mExtent[2]>1) mDim=3;
- else if (mExtent[1]>1) mDim=2;
- else if (mExtent[0]>1) mDim=1;
- else mDim=0;
+ sscanf(x.c_str(),"%d",&mExtent[0]);
+ sscanf(y.c_str(),"%d",&mExtent[1]);
+ sscanf(z.c_str(),"%d",&mExtent[2]);
+ sscanf(t.c_str(),"%d",&mExtent[3]);
+ if(x==""){mExtent[0]=1;}
+ if(y==""){mExtent[1]=1;}
+ if(z==""){mExtent[2]=1;}
+ if(t==""){mExtent[3]=1;}
+
+ if (mExtent[3]>1) mDim=4;
+ else if (mExtent[2]>1) mDim=3;
+ else if (mExtent[1]>1) mDim=2;
+ else if (mExtent[0]>1) mDim=1;
+ else mDim=0;
}
///Clears the extent
}
s.push_back(out);
}
+/**/
+ else // ici, on traite le cas *vraiment* n*2D as 3D // JPR
+ {
+ typedef std::vector<GDCM_NAME_SPACE::File* > FileList;
+ FileList fileVector;
+ //GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
+ GDCM_NAME_SPACE::SerieHelper *sh = GDCM_NAME_SPACE::SerieHelper::New();
+ std::vector<std::string>::iterator it;
+ for (it=im.begin(); it!=im.end(); ++it)
+ {
+ //std::cout << "avant Load ---------" << *it << std::endl;
+
+ ///\TODO liberer les GDCM_NAME_SPACE::File a la fin! // JPR
+ GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
+
+ f->SetFileName(*it);
+ f->Load();
+ if (f->IsReadable())
+ fileVector.push_back(f);
+ else
+ std::cout << "File [" << *it << "] not GDCM Readable; Skipped!" << std::endl;
+ }
+
+ /*
+ for (int i=0; i<fileVector.size();i++)
+ {
+ std::cout << "avant tri ---------" << fileVector[i]->GetFileName() << std::endl;
+ }
+ */
+ if (!sh->IsCoherent(&fileVector))
+ {
+ std::cout << "---------fileset is NOT coherent ?!?" << *it << std::endl;
+ //return;
+ }
+ else
+ {
+ sh->OrderFileList(&fileVector);
+ }
+ /*
+ for (int i=0; i<fileVector.size();i++)
+ {
+ std::cout << "apres tri ---------" << fileVector[i]->GetFileName() << std::endl;
+ }
+ */
+ vtkGdcmReader *reader = vtkGdcmReader::New();
+ reader->SetCoherentFileList(&fileVector);
+ reader->Update();
+ s.push_back(reader->GetOutput());
+ reader->GetOutput()->Print(std::cout);
+ }
+ /**/
}
}
//======================================================================