[vtkusers] vtkImageReslice and vtkImageResample, different behaviour between 32-bit and 64-bit platform

jimmigoo jimmigoo at gmail.com
Wed Jan 26 17:03:41 EST 2011


Hi everyone!
I would like to ask you about a very strange behaviour of VTK 5.6.0
libraries, especially both vtkImageReslice and vtkImageResample methods. 
In 32-bit platform (both Windows XP and Windows 7) these two methods works
correctly, while in 64-bit platform (both Windows XP and Windows 7) the
PointData array contains data with 0 values after this->Update() (or
this->Modified() ), as described in the following code

void ResampleDTM()
{
      //------------- open original file ----------------------------------
      vtkStructuredPointsReader* imageReader =
vtkStructuredPointsReader::New();
      imageReader->SetFileName(“SaintHelene.vtk”);
      imageReader->Update();
      //------------- reslice original vtkImageData ------------------------
      vtkImageReslice* reslice = vtkImageReslice::New();
      reslice->SetInput(imageReader->GetOutput());
      reslice->SetOutputOrigin(X0,Y0,0);
      reslice->SetOutputSpacing(xResolution,yResolution,0);
      int XExtent = (int)((Xmax_new- Xmin_new)/xResolution);
      int YExtent = (int)((Ymax_new- Ymin_new)/yResolution);
      reslice->SetOutputExtent(0,XExtent-1,0,YExtent-1,0,0);
      reslice->Update();
      //------------- resample original vtkImageData
------------------------
      vtkImageResample * resample = vtkImageResample::New();
      resample->SetInputConnection(0, reslice->GetOutputPort());
      resample->SetDimensionality(3);
      resample->SetAxisMagnificationFactor(0,1.0);
      resample->SetAxisMagnificationFactor(1,1.0);
      resample->SetAxisMagnificationFactor(2,1.0);
 
      XExtent = (int)((Xmax_new- Xmin_new)/xResolution_new);
      YExtent = (int)((Ymax_new- Ymin_new)/yResolution_new);
 
      resample->SetOutputOrigin(X0_new,Y0_new,0);
      resample->SetOutputExtent(0,XExtent-1,0,YExtent-1,0,0);
      resample->SetAxisOutputSpacing(0, xResolution_new);
      resample->SetAxisOutputSpacing(1, yResolution_new);
      resample->SetAxisOutputSpacing(2, 0);
      resample->Update();
      vtkImageData* map = resample->GetOutput();
      map->GetPointData()->GetArray(0)->SetName("cellvar");
      //------------- write resampled file
----------------------------------
      vtkStructuredPointsWriter* fileWriter =
vtkStructuredPointsWriter::New();
      fileWriter->SetFileTypeToBinary();
      fileWriter->SetInput(resample->GetOutput());
      fileWriter->SetFileName(“output.vtk”);
      fileWriter->Write();
      //----------------- clean up
------------------------------------------
      fileWriter->Delete();
      resample->Delete();
      reslice->Delete();
      imageReader->Delete();
     
//---------------------------------------------------------------------
}

Have you found a similar behaviour? Do you know how to fix and solve this
problem in 64-bit based platform applications?
I’m looking for your reply!
Best regards, 

jimmigoo
http://vtk.1045678.n5.nabble.com/file/n3358830/SaintHelene.vtk
SaintHelene.vtk 
http://vtk.1045678.n5.nabble.com/file/n3358830/SaintHelene.vtk
SaintHelene.vtk 
-- 
View this message in context: http://vtk.1045678.n5.nabble.com/vtkImageReslice-and-vtkImageResample-different-behaviour-between-32-bit-and-64-bit-platform-tp3358830p3358830.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list