+ {
+ // 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);
+ }
+ }
+ else
+ {
+ // n*2D to 3D
+ vtkImageData* out = vtkImageData::New();
+ out->CopyStructure(first);
+ out->SetScalarType(first->GetScalarType());
+ int ext[6];
+ //first->GetExtent(ext); // JPR
+ first->GetWholeExtent(ext); // renvoie egalement 0,0 en Z // JPR
+
+std::cout <<"in GimmickView::ReadImagesNotThreaded GetWholeExtent ext =";
+for (int jjj=0;jjj<6;jjj++)
+ std:cout << " [" << jjj << "]=" << ext[jjj];
+std::cout << std::endl;
+
+ if(ext[5] == 0)
+ {
+ ext[5] = im.size()-1;
+ }
+ else
+ {
+ ext[5] = ext[5] * im.size()-1; // to deal with multiframes - JPR
+ }
+ out->SetExtent(ext);
+
+ // LG : TODO : Z Spacing ?
+
+ out->AllocateScalars();
+
+ //first->Print(std::cout);
+ // out->Print(std::cout);
+
+ int dim[3];
+ first->GetDimensions(dim);
+ unsigned long imsize = dim[0] * dim[1];
+ imsize = imsize * dim[2] ; // deal with multiframes // JPR
+//EED 03-11-2009
+ imsize = imsize * first->GetScalarSize();
+
+ int slice = 0;
+ std::vector<std::string>::iterator it;
+ for (it=im.begin(); it!=im.end(); ++it)
+ {
+
+ vtkImageData* cur = mReader.GetImage( (*it));
+ // void* src = cur->GetScalarPointer(0,0,0);
+ // void* dst = out->GetScalarPointer(0,0,slice);
+ memcpy(out->GetScalarPointer(0,0,slice), cur->GetScalarPointer(0,0,0), imsize);
+
+ slice++;
+ }
+ s.push_back(out);
+ }
+ }
+}
+ //======================================================================
+
+void GimmickView::ReadImagesNotThreadedInVector(std::vector<vtkImageData*>& s, std::vector<std::string> im, int dimension)
+{
+ // Create the output data
+ if (im.size()==1)
+ {