<font size="2"><font face="verdana,sans-serif"><a href="http://itk.org/Wiki/ITK/Examples/IO/VolumeFromSlices">http://itk.org/Wiki/ITK/Examples/IO/VolumeFromSlices</a><br></font></font><br><div>HTH</div><div><br><div class="gmail_quote">

On Thu, Jul 14, 2011 at 17:30, Luca <span dir="ltr">&lt;<a href="mailto:luca.pedr@gmail.com">luca.pedr@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi!<br>
<br>
I&#39;ve a series of slices, derivated form dicom images and exported in jpeg (named Slice1.jpeg... Slice23.jpeg).<br>
I&#39;ve to reconstruct a 3d volume. If I use directly dicom files it&#39;s very simple, using vtkDicomImageReader class and specificating the folder.<br>
<br>
But if i have to make the same thing with vtkJpegReader the result is an all black windows...<br>
Having dicom images too, i can use one of these to get the width, the height of the image and origin, spacing and extent of the series.<br>
<br>
This is my code, written in c# .net using activiz<br>
##########<br>
jpegreader.SetFilePrefix(<u></u>folderName+&quot;\\Slice&quot;);<br>
jpegreader.SetFilePattern(&quot;%d.<u></u>jpeg&quot;);<br>
vtkDICOMImageReader header = vtkDICOMImageReader.New();<br>
header.SetFileName(&quot;C:\\Users\<u></u>\Luca\\Desktop&quot; + &quot;\\IM-0001-0001.dcm&quot;);<br>
header.Update();<br>
<br>
int height = header.GetHeight();<br>
int width = header.GetWidth();<br>
int depth = 23;<br>
<br>
jpegreader.<u></u>SetFileNameSliceOffset(1);<br>
jpegreader.<u></u>SetFileNameSliceSpacing(1);<br>
double[] spacing = new double[3];<br>
double[] origin = new double[3];<br>
int[] extent = new int[6];<br>
spacing=header.GetDataSpacing(<u></u>);<br>
origin = header.GetDataOrigin();<br>
<br>
jpegreader.SetDataSpacing(<u></u>spacing[0], spacing[1], spacing[2]);<br>
jpegreader.SetDataOrigin(<u></u>origin[0],origin[1],origin[2])<u></u>;<br>
jpegreader.SetDataExtent(0, width - 1, 0, height - 1, 0, depth - 1);<br>
jpegreader.<u></u>SetDataScalarTypeToUnsignedCha<u></u>r();<br>
<br>
vtkRenderer renderer = renderWindow3D.RenderWindow.<u></u>GetRenderers().<u></u>GetFirstRenderer();<br>
<br>
vtkFixedPointVolumeRayCastMapp<u></u>er texMapper = vtkFixedPointVolumeRayCastMapp<u></u>er.New();<br>
vtkVolume vol = vtkVolume.New();<br>
vtkColorTransferFunction ctf = vtkColorTransferFunction.New()<u></u>;<br>
vtkPiecewiseFunction spwf = vtkPiecewiseFunction.New();<br>
vtkPiecewiseFunction gpwf = vtkPiecewiseFunction.New();<br>
<br>
//Go through the visulizatin pipeline<br>
texMapper.SetInputConnection(<u></u>jpegreader.GetOutputPort());<br>
<br>
//Set the color curve for the volume<br>
 ctf.AddHSVPoint(0, .67, .07, 1);<br>
ctf.AddHSVPoint(94, .67, .07, 1);<br>
ctf.AddHSVPoint(139, 0, 0, 0);<br>
ctf.AddHSVPoint(160, .28, .047, 1);<br>
ctf.AddHSVPoint(254, .38, .013, 1);<br>
<br>
//Set the opacity curve for the volume<br>
spwf.AddPoint(84, 0);<br>
spwf.AddPoint(151, .1);<br>
spwf.AddPoint(255, 1);<br>
<br>
//Set the gradient curve for the volume<br>
gpwf.AddPoint(0, .2);<br>
gpwf.AddPoint(10, .2);<br>
gpwf.AddPoint(25, 1);<br>
<br>
vol.GetProperty().SetColor(<u></u>ctf);<br>
vol.GetProperty().<u></u>SetScalarOpacity(spwf);<br>
vol.GetProperty().<u></u>SetGradientOpacity(gpwf);<br>
vol.SetMapper(texMapper);<br>
<br>
//Go through the Graphics Pipeline<br>
renderer.AddVolume(vol);<br>
renderer.ResetCamera();<br>
this.renderWindow3D.<u></u>RenderWindow.Render();<br>
renderer.Render();<br>
#########<br>
<br>
Where I&#39;m wrong??<br>
<br>
Thanks<br>
______________________________<u></u>_________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_<u></u>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/<u></u>listinfo/vtkusers</a><br>
</blockquote></div><br></div>