<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Italo Ribeiro</b> <span dir="ltr"><<a href="mailto:italo.ribeiro@gmail.com">italo.ribeiro@gmail.com</a>></span><br>
Date: 2010/9/10<br>Subject: Re: [vtkusers] help:how to get 2D image by maximum intensity projection?<br>To: 陆阳 <<a href="mailto:thuluyang@gmail.com">thuluyang@gmail.com</a>><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->SetDirectoryName("C:/cranio");<br>Â Â Â reader->Update();<br><br>//create MIP projection --------------------------------------------------------------------------------------------------------------------------<br>
vtkImageCast *cast = vtkImageCast::New();<br>Â Â Â cast->SetInputConnection(reader->GetOutputPort());<br>Â Â Â cast->SetOutputScalarTypeToUnsignedChar();<br><br>Â Â //define range of values<br>Â Â Â vtkPiecewiseFunction *opacityTransferFunction = vtkPiecewiseFunction::New();<br>
       opacityTransferFunction->AddPoint( 150 , 0.0 );<br>       opacityTransferFunction->AddPoint( 255 , 1.0 );<br><br><br>   //Create a transfer function mapping scalar value to color (grey)<br>   vtkPiecewiseFunction *grayTransferFunction = vtkPiecewiseFunction::New();<br>
   grayTransferFunction->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->SetScalarOpacity( opacityTransferFunction );<br>
   mipProperty->SetColor( grayTransferFunction );<br>   mipProperty->SetInterpolationTypeToLinear();<br><br>   vtkVolumeRayCastMIPFunction* mipFunction = vtkVolumeRayCastMIPFunction::New();<br>   mipFunction->SetMaximizeMethodToOpacity();<br>
<br>Â Â Â vtkVolumeRayCastMapper* volumeMapper = vtkVolumeRayCastMapper::New();<br>Â Â Â volumeMapper->SetVolumeRayCastFunction( mipFunction );<br>Â Â Â volumeMapper->SetInput( cast->GetOutput() );<br><br>Â Â Â vtkVolume* volume = vtkVolume::New();<br>
   volume->SetMapper( volumeMapper );<br>   volume->SetProperty( mipProperty );<br>   <br>   vtkRenderer *renderer1 = vtkRenderer::New();<br>   renderer1->SetViewport(0.5, 0.5, 1.0, 1.0);<br>   renderer1->SetBackground(0.0, 0.0, 0.0);<br>
   renderWindow->AddRenderer(renderer1);<br><br>   renderer1->AddViewProp(volume);<br><br>//create image viewer --------------------------------------------------------------------------------------------------------------------------------<br>
<br>vtkImageViewer2 *viewer = vtkImageViewer2::New();<br>Â Â Â viewer->SetInput(reader->GetOutput());<br><br>Â Â Â viewer->GetRenderer()->SetViewport(0.0, 0.5, 0.5, 1.0);<br>Â Â Â renderWindow->AddRenderer(viewer->GetRenderer());<br>
<br>Â Â Â viewer->OffScreenRenderingOn(); //dont show window of load images<br>Â Â Â int VolData_Images = viewer->GetSliceMax();<br>Â Â Â viewer->SetSlice(50); //slice showed<br><br><br><br>The values of pixel image i get:<br>
<br>short* tuple = (short*)image->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"><<a href="mailto:thuluyang@gmail.com" target="_blank">thuluyang@gmail.com</a>></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->SetDirectoryName("C:/mrdata");<br>vtkImageShiftScale *scale=vtkImageShiftScale::New();</p>
<p><br>scale->SetInput(volumeReader->GetOutput());<br>scale->SetOutputScalarTypeToUnsignedChar();<br>scale->Update();</p>
<p><br>vtkVolumeRayCastMIPFunction *MIP = vtkVolumeRayCastMIPFunction::New();<br>vtkVolumeRayCastMapper *RaycastMapper = vtkVolumeRayCastMapper::New();<br>RaycastMapper->SetVolumeRayCastFunction(MIP);<br>Â Â Â RaycastMapper->SetInput(scale->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>