[vtkusers] Puzzled: vtkImageReslice->reorienting a volume

Audrius Stundzia adv_biologic at hotmail.com
Fri Jun 9 17:18:20 EDT 2000


Hi fellow vtker's

In my application, I'm now trying to use vtkImageReslice to re-orient
a vtkImageData volume along a new axis set. I load a vtkMatrix4x4
with this new axis set, but I'm not sure what the vtkTransform should
be. Should it be the
1) rotation matrix defined by the direction cosines between the old and new 
axes or should it be
2) just it identity matrix?

Searching the vtk mailing list archive unfortunately confused me even more 
:)

The other problem is that the following code crashes with the error
message:

ERROR: In vtkImageData.cxx, line 1298
vtkImageData (0xbc85d0): Attempt to allocate scalars before scalar type was 
set!.

   testImageData = vtkImageData::New();
   testImageData->SetDimensions( nVoxels[X], nVoxels[Y], nVoxels[Z] );
   testImageData->SetOrigin( 0.0, 0.0, 0.0 );
   testImageData->SetSpacing( voxelSize[X], voxelSize[Y], voxelSize[Z] );
   testImageData->GetPointData()->SetScalars( testVolumeScalars);
   testImageData->Update();

   //-----I've extracted isosurfaces from testImageData so I know it's    
//-----okay

   //------------------------------------------------
   //-----Reorient (reslice) the 3D image data volume
   //------------------------------------------------

   testImageReslice = vtkImageReslice::New();
   testImageReslice->SetOutputOrigin( 0, 0, 0 );
   testImageReslice->SetOutputSpacing( voxelSize);
   testImageReslice->SetOutputExtent( nVoxels);

   testImageReslice->OptimizationOn();
   testImageReslice->SetBackgroundLevel( 0);

   testImageReslice->SetInput( testImageData);

   testImageReslice->SetResliceAxes( testOrientationMatrix);

   //-----I'm not sure what the testOrientationTransform should be

   testImageReslice->SetResliceTransform( testOrientationTransform);

   testImageReslice->SetInterpolationModeToNearestNeighbor();

   testImageReslice->OutputAlwaysCenteredOnInputOn();

   testOrientedImageData = testImageReslice->GetOutput();

   //-----This next line where the code crashes with the above error      
//-----message
   testImageReslice->Update();
   //-----

   testImageData->ReleaseDataFlagOn();

//-----

If I comment out the offending line, then the same error occurs later
when I input  testOrientedImageData into vtkImageMarchingCubes

Any insight would be much appreciated.

OS: Solaris 2.6
vtk 3.1: NR 8 June 2000

Sincerely,

Audrius Stundzia

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com





More information about the vtkusers mailing list