<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Italo Ribeiro</b> <span dir="ltr">&lt;<a href="mailto:italo.ribeiro@gmail.com">italo.ribeiro@gmail.com</a>&gt;</span><br>

Date: 2010/9/10<br>Subject: Re: [vtkusers] help:how to get 2D image by maximum intensity projection?<br>To: é™†é˜³ &lt;<a href="mailto:thuluyang@gmail.com">thuluyang@gmail.com</a>&gt;<br><br><br>Hi, my english is poor too.<br>

<br>I am use vtkImageViewer2 for see the DICOM images. I am use the code:<br><br>//read DICOM images ---------------------------------------------------------------------------------------------------------------------------<br>


vtkDICOMImageReader *reader = vtkDICOMImageReader::New();<br>    reader-&gt;SetDirectoryName(&quot;C:/cranio&quot;);<br>    reader-&gt;Update();<br><br>//create MIP projection --------------------------------------------------------------------------------------------------------------------------<br>


vtkImageCast *cast = vtkImageCast::New();<br>    cast-&gt;SetInputConnection(reader-&gt;GetOutputPort());<br>    cast-&gt;SetOutputScalarTypeToUnsignedChar();<br><br>   //define range of values<br>    vtkPiecewiseFunction *opacityTransferFunction = vtkPiecewiseFunction::New();<br>


        opacityTransferFunction-&gt;AddPoint( 150 , 0.0 );<br>        opacityTransferFunction-&gt;AddPoint( 255 , 1.0 );<br><br><br>    //Create a transfer function mapping scalar value to color (grey)<br>    vtkPiecewiseFunction *grayTransferFunction = vtkPiecewiseFunction::New();<br>


    grayTransferFunction-&gt;AddSegment( 0 , 0.0 , 255 , 1.0 );<br><br>    // Create a set of properties for mip<br>    vtkVolumeProperty *mipProperty;<br>    mipProperty = vtkVolumeProperty::New();<br>    mipProperty-&gt;SetScalarOpacity( opacityTransferFunction );<br>


    mipProperty-&gt;SetColor( grayTransferFunction );<br>    mipProperty-&gt;SetInterpolationTypeToLinear();<br><br>    vtkVolumeRayCastMIPFunction* mipFunction = vtkVolumeRayCastMIPFunction::New();<br>    mipFunction-&gt;SetMaximizeMethodToOpacity();<br>


<br>    vtkVolumeRayCastMapper* volumeMapper = vtkVolumeRayCastMapper::New();<br>    volumeMapper-&gt;SetVolumeRayCastFunction( mipFunction );<br>    volumeMapper-&gt;SetInput( cast-&gt;GetOutput() );<br><br>    vtkVolume* volume = vtkVolume::New();<br>


    volume-&gt;SetMapper( volumeMapper );<br>    volume-&gt;SetProperty( mipProperty );<br>    <br>    vtkRenderer *renderer1 = vtkRenderer::New();<br>    renderer1-&gt;SetViewport(0.5, 0.5, 1.0, 1.0);<br>    renderer1-&gt;SetBackground(0.0, 0.0, 0.0);<br>


    renderWindow-&gt;AddRenderer(renderer1);<br><br>    renderer1-&gt;AddViewProp(volume);<br><br>//create image viewer --------------------------------------------------------------------------------------------------------------------------------<br>


<br>vtkImageViewer2 *viewer = vtkImageViewer2::New();<br>    viewer-&gt;SetInput(reader-&gt;GetOutput());<br><br>    viewer-&gt;GetRenderer()-&gt;SetViewport(0.0, 0.5, 0.5, 1.0);<br>    renderWindow-&gt;AddRenderer(viewer-&gt;GetRenderer());<br>


<br>    viewer-&gt;OffScreenRenderingOn(); //dont show window of load images<br>    int VolData_Images = viewer-&gt;GetSliceMax();<br>    viewer-&gt;SetSlice(50); //slice showed<br><br><br><br>The values of pixel image i get:<br>


<br>short* tuple = (short*)image-&gt;GetScalarPointer(image_coordinate);<br><br><br><br><br>I hope this code help you. I dont know what i doing bad. I want MIP values of pixel.<br><br><br><div class="gmail_quote">2010/9/10 é™†é˜³ <span dir="ltr">&lt;<a href="mailto:thuluyang@gmail.com" target="_blank">thuluyang@gmail.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5"><p><br clear="all">hello,sorry to interupt you .<br>but i have a really important question.i am asking you for help.<br>


i am a new learner of vtk.<br>recently,i am using vtk to do 3d reconstruction.<br>i am using mip(maximum intenstity projection ) to do this.<br>
first reading some silces of ct dicom image,then do the projection.<br>as you know vtk is using pipeline ,we can only get 3d volume.<br>but what i want is the 2d image by MIP.<br>i dont know if i make myself understood by you? my english is poor.<br>



here is the main code:<br>//read the dicoms<br>vtkDICOMImageReader *volumeReader = vtkDICOMImageReader::New();<br>volumeReader-&gt;SetDirectoryName(&quot;C:/mrdata&quot;);<br>vtkImageShiftScale *scale=vtkImageShiftScale::New();</p>




<p><br>scale-&gt;SetInput(volumeReader-&gt;GetOutput());<br>scale-&gt;SetOutputScalarTypeToUnsignedChar();<br>scale-&gt;Update();</p>
<p><br>vtkVolumeRayCastMIPFunction *MIP = vtkVolumeRayCastMIPFunction::New();<br>vtkVolumeRayCastMapper *RaycastMapper = vtkVolumeRayCastMapper::New();<br>RaycastMapper-&gt;SetVolumeRayCastFunction(MIP);<br>    RaycastMapper-&gt;SetInput(scale-&gt;GetOutput());</p>




<p><br>here is the case, where i can get the 2d image i want?<br>i couldnot find any interface.but i think the image should be the output of  RaycastMapper?<br>the pity is i cant find any output of RaycastMapper.<br>could you give me some suggestions?<br>



-- <br>陆阳<br>清华大学医学院生物医学工程系<br>Yang Lu<br>Department of Biomedical Engineering,<br>School of Medicine, Tsinghua University<br>电话/Tel:+86-010-51532315<br></p>
<br></div></div>_______________________________________________<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/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_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/listinfo/vtkusers</a><br>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>Ítalo Mendes<br><a href="http://ogre.irados.org" target="_blank">ogre.irados.org</a><br>
</font></div><br><br clear="all"><br>-- <br>Ítalo Mendes<br><a href="http://ogre.irados.org">ogre.irados.org</a><br>