+
+ } // dimension == 3
+
+ } // size >1
+
+}
+ //======================================================================
+
+
+double GimmickView::OrderTheFileNameVector(std::vector<std::string> &im)
+{
+ double spacing=1;
+ 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> lstAux;
+ std::vector<std::string>::iterator it;
+ for (it=im.begin(); it!=im.end(); ++it)
+ {
+ ///\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 {
+ lstAux.push_back(*it);
+ }
+ } // for
+
+
+ if ((fileVector.size()>1) && (sh->IsCoherent( &fileVector )))
+ {
+ sh->OrderFileList(&fileVector);
+ spacing= sh->GetZSpacing();
+ im.clear();
+ int i;
+ for (i=0; i<fileVector.size(); i++)
+ {
+ im.push_back( (fileVector[i])->GetFileName() );
+ }
+ for (i=0; i<lstAux.size(); i++)
+ {
+ im.push_back( lstAux[i] );
+ }
+ }else {
+ std::sort( im.begin(), im.end() );
+ }
+
+ return spacing;
+}
+
+
+//======================================================================
+
+
+void GimmickView::ReadImagesNotThreadedInVector(std::vector<vtkImageData*>& s, std::vector<std::string> im, int dimension)
+{
+ // Create the output data
+ if (im.size()==1)
+ {
+ // Only one image : give it
+ vtkImageData* out = vtkImageData::New();
+ GimmickDebugMessage(3, "State Check: Full Filename: "
+ <<im.front()
+ <<std::endl);
+ out->ShallowCopy(mReader.GetImage(im.front()));
+ s.push_back( out );
+ }
+ else if (im.size()>1) // Test inutile ? JPR
+ {
+ vtkImageData* first = mReader.GetImage( im.front());
+ if (dimension == 2)
+ {
+ // n3D
+ std::vector<std::string>::iterator it;
+ for (it=im.begin(); it!=im.end(); ++it)
+ {
+ vtkImageData* out = vtkImageData::New();
+ out->ShallowCopy(mReader.GetImage(*it));
+ s.push_back(out);
+ }