<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1170" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN
class=434542018-11072003>Hello:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=434542018-11072003>
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=434542018-11072003>
I'm trying to use a vtkImageReslice to resample a 3D dataset along the Z axis.
The code works fine until I change the interp mode to linear or cubic: then I
just get junk data. Am I missing a step?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=434542018-11072003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=434542018-11072003><FONT size=3>
<P>vtkImageImport* Importer = vtkImageImport::New();</P>
<P>vtkImageExport* Exporter = vtkImageExport::New();</P>
<P>vtkImageReslice* Resampler = vtkImageReslice::New();</P>
<P>vtkImageData* InData = vtkImageData::New();</P>
<P>vtkImageFlip* InFlip = vtkImageFlip::New();</P>
<P></FONT><FONT color=#0000ff size=3>float</FONT><FONT size=3> InOrigin[3];</P>
<P>InOrigin[0] = - InDim[0] * InSpacing[0] * 0.5;</P>
<P>InOrigin[1] = - InDim[1] * InSpacing[1] * 0.5;</P>
<P>InOrigin[2] = - InDim[2] * InSpacing[2] * 0.5;</P>
<P></P>
<P></FONT><FONT color=#0000ff size=3>float</FONT><FONT size=3> OutOrigin[3];</P>
<P>OutOrigin[0] = - OutDim[0] * OutSpacing[0] * 0.5;</P>
<P>OutOrigin[1] = - OutDim[1] * OutSpacing[1] * 0.5;</P>
<P>OutOrigin[2] = - OutDim[2] * OutSpacing[2] * 0.5;</P>
<P><FONT size=2></FONT> </P>
<P>Importer->SetDataExtent(0,InDim[0] - 1, 0, InDim[1] - 1, 0, InDim[2] -
1);</P>
<P>Importer->SetWholeExtent(0,InDim[0] - 1, 0, InDim[1] - 1, 0, InDim[2] -
1);</P>
<P>Importer->SetDataOrigin(InOrigin[0], InOrigin[1], InOrigin[2]);</P>
<P>Importer->SetDataScalarType(VTK_UNSIGNED_SHORT);</P>
<P>Importer->SetImportVoidPointer(InArray, 1);</P>
<P>Importer->Update();</P>
<P>Importer->UpdateWholeExtent();</P>
<P></P>
<P>InData = Importer->GetOutput();</P>
<P>InData->SetSpacing(InSpacing);</P>
<P>InData->SetOrigin(InOrigin[0], InOrigin[1], InOrigin[2]);</P>
<P>InData->SetWholeExtent(Importer->GetWholeExtent());</P>
<P>InData->Update();</P></FONT><FONT size=3>
<P>InData->SetUpdateExtentToWholeExtent();</P></FONT>
<P><FONT size=3>Resampler->SetInput(InData);</P>
<P>Resampler->SetOutputDimensionality(3);</P></FONT><FONT color=#008000
size=3>
<P>// Resampler->SetInterpolationModeToLinear();</P></FONT><FONT size=3>
<P>Resampler->AutoCropOutputOn();</P>
<P>Resampler->SetBackgroundLevel(125);</P>
<P>Resampler->SetOutputOrigin(OutOrigin);</P>
<P>Resampler->SetOutputSpacing(OutSpacing[0], OutSpacing[1],
OutSpacing[2]);</P>
<P>Resampler->SetOutputExtent(0, OutDim[0] - 1, 0, OutDim[1] - 1, 0,
OutDim[2] - 1);</P>
<P>Resampler->ReleaseDataFlagOff();</P>
<P>Resampler->UpdateWholeExtent();</P>
<P></P>
<P>Exporter->SetInput(Resampler->GetOutput());</P>
<P>Exporter->SetExportVoidPointer(OutArray);</P>
<P>Exporter->Export();</P></FONT></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=434542018-11072003>
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV align=left><FONT face=Arial size=2>Todd Baker</FONT></DIV></BODY></HTML>