<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<meta content="MSHTML 6.00.2900.3059" name="GENERATOR">
</head>
<body>
<div dir="ltr" align="left"><span class="205204115-06012009"><font face="Arial" color="#0000ff" size="2">Thank you guys. Just as you guys said the problem is the file.</font></span></div>
<div dir="ltr" align="left"><span class="205204115-06012009"><font face="Arial" color="#0000ff" size="2">&nbsp;Scalars must have a name &quot;scalars&quot;</font></span></div>
<div dir="ltr" align="left"><span class="205204115-06012009"><font face="Arial" color="#0000ff" size="2"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span class="205204115-06012009"><font face="Arial" color="#0000ff" size="2">Thanks a lot!</font></span></div>
<div dir="ltr" align="left"><span class="205204115-06012009"><font face="Arial" color="#0000ff" size="2">yang</font></span></div>
<br>
<div class="OutlookMessageHeader" lang="en-us" dir="ltr" align="left">
<hr tabindex="-1">
<font face="Tahoma" size="2"><b>From:</b> vtkusers-bounces@vtk.org [mailto:vtkusers-bounces@vtk.org]
<b>On Behalf Of </b>stevannindya henryanto<br>
<b>Sent:</b> 2009年1月6日 4:00<br>
<b>To:</b> vtkusers@vtk.org<br>
<b>Subject:</b> [vtkusers] help! reslice a raw image<br>
</font><br>
</div>
<div></div>
Hello,<br>
I'm trying to view an image from 3D raw volume. I'm using vtkImageReslice for doing it. But, I got a blank view after viewing the output using vtkImageViewer. Here is my code :<br>
<br>
------------------------------------------------------------------------------------------------<br>
vtkImageReader2 *reader = vtkImageReader2::New();<br>
reader-&gt;SetFileName(&quot;prone8.raw&quot;);<br>
reader-&gt;SetFileDimensionality(3);<br>
reader-&gt;SetDataByteOrderToBigEndian();<br>
reader-&gt;SetNumberOfScalarComponents(1);<br>
reader-&gt;SetDataExtent(0, 511, 0, 511, 0, 462);<br>
reader-&gt;SetDataSpacing(0.625, 0.625, 1.0);<br>
reader-&gt;SetDataOrigin(0.0, 0.0, 0.0);<br>
reader-&gt;UpdateWholeExtent();<br>
//calculate the center of the volume<br>
reader-&gt;GetOutput()-&gt;UpdateInformation();<br>
int extent[6];<br>
double spacing[3];<br>
double origin[3];<br>
reader-&gt;GetOutput()-&gt;GetWholeExtent(extent);<br>
reader-&gt;GetOutput()-&gt;GetSpacing(spacing);<br>
reader-&gt;GetOutput()-&gt;GetOrigin(origin);<br>
double center[3];<br>
center[0] = (origin[0] &#43; spacing[0] * 0.5 * (extent[0] &#43; extent[1]));<br>
center[1] = (origin[1] &#43; spacing[1] * 0.5 * (extent[2] &#43; extent[3]));<br>
center[2] = (origin[2] &#43; spacing[2] * 0.5 * (extent[4] &#43; extent[5]));<br>
//matrix for axial view<br>
static double axialElements[16] = {<br>
1, 0, 0, 0,<br>
0, 1, 0, 0,<br>
0, 0, 1, 0,<br>
0, 0, 0, 1};<br>
//set slice orientation<br>
vtkMatrix4x4 *resliceAxes = vtkMatrix4x4::New();<br>
resliceAxes-&gt;DeepCopy(axialElements);<br>
<br>
//set the point through which to slice<br>
//set i,j setElement(i,j,double);<br>
resliceAxes-&gt;SetElement(0, 3, center[0]);<br>
resliceAxes-&gt;SetElement(1, 3, center[1]);<br>
resliceAxes-&gt;SetElement(2, 3, center[2]);<br>
<br>
//extract slice<br>
vtkImageReslice *reslice = vtkImageReslice::New();<br>
reslice-&gt;SetInputConnection(reader-&gt;GetOutputPort());<br>
reslice-&gt;SetOutputDimensionality(2);<br>
reslice-&gt;SetResliceAxes(resliceAxes);<br>
reslice-&gt;SetInterpolationModeToLinear();<br>
<br>
// Create a greyscale lookup table<br>
vtkLookupTable *table = vtkLookupTable::New();<br>
table-&gt;SetRange(0, 2000); // image intensity range<br>
table-&gt;SetValueRange(0.0, 1.0); // from black to white<br>
table-&gt;SetSaturationRange(0.0, 0.0); // no color saturation<br>
table-&gt;SetRampToLinear();<br>
table-&gt;Build();<br>
<br>
// Map the image through the lookup table<br>
vtkImageMapToColors *color = vtkImageMapToColors::New();<br>
color-&gt;SetLookupTable(table);<br>
color-&gt;SetInputConnection(reslice-&gt;GetOutputPort());<br>
/ <br>
//view the image<br>
viewer = vtkImageViewer2::New();<br>
viewer-&gt;SetInput(color-&gt;GetOutput());<br>
viewer-&gt;SetSize(512,512);<br>
// viewer-&gt;SetZSlice(sliderValueChanged());<br>
qvtk-&gt;SetRenderWindow(viewer-&gt;GetRenderWindow()); <br>
reader-&gt;Delete(); <br>
------------------------------------------------------------------------------------------------<br>
<br>
I'm using qt3 here. Plese help me....<br>
Thanks...<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<hr>
<font face="Arial" color="Gray" size="2">Email Disclaimer: www.stjude.org/emaildisclaimer<br>
</font>
</body>
</html>