- }
-
- else if (im.size()>1)
- {
- vtkImageData* first = mReader.GetImage( im.front());
- if (dimension==2)
- {
- // n2D to 3D
- vtkImageData* out = vtkImageData::New();
- out->CopyStructure(first);
- out->SetScalarType(first->GetScalarType());
- int ext[6];
- first->GetExtent(ext);
- ext[5] = im.size();
- 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 =
- ( (unsigned long)first->GetScalarPointer(0,1,0)
- - (unsigned long)first->GetScalarPointer(0,0,0))
- *dim[1];
-
- int slice = 0;
- std::vector<std::string>::iterator it;
- for (it=im.begin(); it!=im.end(); ++it)
- {
- //std::cout << "copying slice "<<slice <<std::endl;
- vtkImageData* cur = mReader.GetImage( (*it));
+ }
+ 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
+ {
+ // n2D to 3D
+ vtkImageData* out = vtkImageData::New();
+ out->CopyStructure(first);
+ out->SetScalarType(first->GetScalarType());
+ int ext[6];
+ first->GetExtent(ext);
+ 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
+
+ /*
+ ( (unsigned long)first->GetScalarPointer(0,1,0)
+ - (unsigned long)first->GetScalarPointer(0,0,0))
+ *dim[1];*/
+
+ int slice = 0;
+ std::vector<std::string>::iterator it;
+ for (it=im.begin(); it!=im.end(); ++it)
+ {