Hi Yixun,<br><br>I am using the volumerendering library as you mentioned. But still I am getting the following errors.<br>1)ERROR: In ..\..\IO\vtkDICOMImageReader<div>.cxx, line 255<br>vtkDICOMImageReader
(0033C900): Either a filename was not specified or the specified
directory does not contain any DICOM images.
<br><br>2)ERROR: In ..\..\VolumeRendering\vtkVolumeRayCastMapper.cxx, line 326<br>vtkVolumeRayCastMapper (02953718): Cannot volume render data of type short, only unsigned char or unsigned short.<br><br>The 2nd error keeps repeating itself again and again.
<br><br>How can I rectify these errors?<br><br>My code is as follows:<br></div><br>-----<br>#include "vtkConeSource.h"<br>#include "vtkPolyDataMapper.h
"<br>#include "vtkRenderWindow.h"<br>#include "vtkCamera.h"<br>#include "vtkActor.h"<div><span class="q">#include "vtkImageActor.h"<br>#include "vtkOutlineFilter.h"<br>
</span></div><div><span class="q">#include "
vtkProperty.h"<br>#include "vtkPolyDataNormals.h"<br>#include "vtkContourFilter.h"<br>#include "vtkDataSetMapper.h"<br>#include "vtkImageMapper.h"<br></span></div><div><span class="q">
#include "vtkPiecewiseFunction.h
"<br>#include "vtkVolumeProperty.h"<br></span></div>#include "vtkRenderer.h"<br>#include "conio.h"<br>#include "vtkDICOMImageReader.h"<br>#include "vtkImageViewer2.h"
<br>#include "
vtkJPEGReader.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkVolumeMapper.h"<br>#include "vtkActor2D.h"<br>#include "vtkPolyDataMapper.h"<br>#include "vtkVolumeRayCastCompositeFuncti
<div>on.h
"<br>#include "vtkVolumeRayCastMapper.h"<br><br>void main()<br>{<br> <br> vtkRenderer *arenderer = vtkRenderer::New();<br> vtkRenderWindow *renwin = vtkRenderWindow::New();<br> vtkDICOMImageReader *img1=vtkDICOMImageReader::New();
<br><br> img1->SetFilePrefix("D:\\testimages\\dicomset\\IM");<br> img1->SetFilePattern("%s%d.dcm");<br> img1->SetFileNameSliceOffset(1);<br> img1->SetFileNameSliceSpacing(1);<br> img1->SetDataExtent(0,511,0,511,1,10);//512x512 images and 10 slices
<br> img1->SetDataSpacing(360.0/512,360.0/512,1.0); //my image is 36cm x 36cm and 512x512<br> img1->SetDataOrigin(0.0,0.0,0.0);<br> img1->Update();<br><br> vtkVolume *vol=vtkVolume::New();<br> vtkVolumeRayCastMapper *volumemapper = vtkVolumeRayCastMapper::New();
<br> vtkVolumeRayCastCompositeFunction *rcf=vtkVolumeRayCastCompositeFunction::New();<br> volumemapper->SetVolumeRayCastFunction(rcf);<br> volumemapper->SetInput(img1->GetOutput());<br> vol->SetMapper(volumemapper);
<br><br> vtkCamera *cam=vtkCamera::New();<br> cam->SetViewUp(0,0,-1);<br> cam->SetPosition(0,1,0);<br> cam->SetFocalPoint(0,0,0);<br> cam->ComputeViewPlaneNormal();<br><br> arenderer->AddActor(vol);<br>
arenderer->SetActiveCamera(cam);<br> arenderer->ResetCamera();<br> arenderer->SetBackground(1,1,1);<br> <br> renwin->AddRenderer(arenderer);<br> vtkRenderWindowInteractor *iren=vtkRenderWindowInteractor::New();
<br> iren->SetRenderWindow(renwin);<br> renwin->Render();<br> iren->Initialize();<br> iren->Start();<br><br> img1->Delete();<br> iren->Delete();<br>}<br>--------<br><br>I would appreciate all help.
<br><br>Thanks,<br>Ashish<br></div><br><br><div><span class="gmail_quote">On 9/13/06, <b class="gmail_sendername">Yixun Liu</b> <<a href="mailto:yxliu@fudan.edu.cn">yxliu@fudan.edu.cn</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div bgcolor="#ffffff">
<div><font face="Bookman Old Style">Hi,</font></div>
<div><font face="Bookman Old Style">When you update vtk from 4.2 to 5.0 the old
rendering.lib has been replaced with volumerendering.lib, so be sure that you
use the volumerendering.lib instead of rendering.lib in you project
configuration.</font></div>
<div><font face="Bookman Old Style"></font> </div>
<div><font face="Bookman Old Style">Cheers,</font></div></div><div><span class="sg">
<div><font face="Bookman Old Style"></font> </div>
<div><font face="Bookman Old Style">Yixun</font></div></span></div><div><span class="e" id="q_10da9c15c887d41a_2">
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><b>From:</b>
<a title="mrasingh@gmail.com" href="mailto:mrasingh@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Ashish Singh</a>
</div>
<div><b>To:</b> <a title="vtkusers@vtk.org" href="mailto:vtkusers@vtk.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">vtkusers@vtk.org</a> </div>
<div><b>Cc:</b> <a title="yxliu@fudan.edu.cn" href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Yixun Liu</a> ; <a title="amy.squillacote@kitware.com" href="mailto:amy.squillacote@kitware.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Amy Squillacote</a> </div>
<div><b>Sent:</b> Thursday, September 14, 2006 1:23
AM</div>
<div><b>Subject:</b> Re: [vtkusers] Re: Re: Re: Creating
a Volume from 2D BMP files.</div>
<div><br></div>Hi Amy,<br><br>I don't remember if VTK_USE_RENDERING variable
was ON or not. Is there a way to confirm that? However I am able to compile
and run other programs from the examples/tutorials directory such as cones
etc. as well as read and display single dicom image and interact with it using
renderwindowinteractor. <br><br>Here is my cmakelists.txt file for cone
example:<br>---<br>PROJECT (Step1)<br><br>FIND_PACKAGE(VTK REQUIRED)<br>IF(NOT
VTK_USE_RENDERING)<br> MESSAGE(FATAL_ERROR "Example ${PROJECT_NAME}
requires VTK_USE_RENDERING.") <br>ENDIF(NOT
VTK_USE_RENDERING)<br>INCLUDE(${VTK_USE_FILE})<br><br>ADD_EXECUTABLE(Cone
Cone.cxx)<br>TARGET_LINK_LIBRARIES(Cone vtkRendering)<br>----<br>This works
fine.<br><br>The cmakelists.txt file that I use for dicom volume problem is :
<br>----<br>PROJECT (multiimagereader)<br><br>INCLUDE
(${CMAKE_ROOT}/Modules/FindVTK.cmake)<br>IF (USE_VTK_FILE)<br>
INCLUDE(${USE_VTK_FILE})<br>ENDIF
(USE_VTK_FILE)<br><br>ADD_EXECUTABLE(multiimagereader multiimagereader.cxx
)<br>TARGET_LINK_LIBRARIES(multiimagereader vtkRendering)<br>----<br>Is there
anything that I need to modify in this
file?<br><br>Thanks,<br>Ashish<br><br><br>
<div><span class="gmail_quote">On 9/13/06, <b class="gmail_sendername">Amy
Squillacote</b> <<a href="mailto:amy.squillacote@kitware.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">amy.squillacote@kitware.com</a>>
wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div text="#000000" bgcolor="#ffffff">Hi Ashish,<br><br>When you built VTK,
was the VTK_USE_RENDERING CMake variable set to ON? If it was, are you
linking against the vtkVolumeRendering library?<br><br>- Amy<br><br>Ashish
Singh wrote:
<blockquote cite="http://mide275438e0609130955v6357c893r163226c364b56c12@mail.gmail.com" type="cite"></blockquote></div>
<div><span>Hi Yixun and Sharwari,<br><br>I
am trying to solve exactly similar problem but using DICOM images rather
than bmp. But I am getting errors and I can't figure out why. My code is
based on your previous conversation so far. The error that I get is:
<br>(1)error LNK2019: unresolved external symbol "public: static class
vtkVolumeRayCastCompositeFunction * __cdecl
vtkVolumeRayCastCompositeFunction::New(void)"
(?New@vtkVolumeRayCastCompositeFunction@@SAPAV1@XZ ) referenced in function
_main<br> (2)error LNK2019: unresolved external symbol "public: static
class vtkVolumeRayCastMapper * __cdecl vtkVolumeRayCastMapper::New(void)"
(?New@vtkVolumeRayCastMapper@@SAPAV1@XZ) referenced in function _main
<br>(3)fatal error LNK1120: 2 unresolved externals<br><br>Can you please
help me figure out what's going wrong here?<br><br>My code is as
follows:<br>-----<br>#include "vtkConeSource.h"<br>#include
"vtkPolyDataMapper.h "<br>#include "vtkRenderWindow.h"<br>#include
"vtkCamera.h"<br>#include "vtkActor.h"<br>#include
"vtkImageActor.h"<br>#include "vtkOutlineFilter.h"<br>#include "
vtkProperty.h"<br>#include "vtkPolyDataNormals.h"<br>#include
"vtkContourFilter.h"<br>#include "vtkDataSetMapper.h"<br>#include
"vtkImageMapper.h"<br>#include "vtkPiecewiseFunction.h "<br>#include
"vtkVolumeProperty.h"<br>#include "vtkRenderer.h"<br>#include
"conio.h"<br>#include "vtkDICOMImageReader.h"<br>#include
"vtkImageViewer2.h"<br>#include " vtkJPEGReader.h"<br>#include
"vtkRenderWindowInteractor.h"<br>#include "vtkVolumeMapper.h"<br>#include
"vtkActor2D.h"<br>#include "vtkPolyDataMapper.h"<br>#include
"vtkVolumeRayCastCompositeFunction.h "<br>#include
"vtkVolumeRayCastMapper.h"<br><br>void main()<br>{<br> <br>
vtkRenderer *arenderer = vtkRenderer::New();<br> vtkRenderWindow
*renwin = vtkRenderWindow::New();<br> vtkDICOMImageReader
*img1=vtkDICOMImageReader::New(); <br><br>
img1->SetFilePrefix("D:\\testimages\\dicomset\\IM");<br>
img1->SetFilePattern("%s%d.dcm");<br>
img1->SetFileNameSliceOffset(1);<br>
img1->SetFileNameSliceSpacing(1);<br>
img1->SetDataExtent(0,511,0,511,1,10);//512x512 images and 10 slices
<br> img1->SetDataSpacing(360.0/512,360.0/512,1.0); //my image is
36cm x 36cm and 512x512<br>
img1->SetDataOrigin(0.0,0.0,0.0);<br>
img1->Update();<br><br> vtkVolume *vol=vtkVolume::New();<br>
vtkVolumeRayCastMapper *volumemapper = vtkVolumeRayCastMapper::New();
<br> vtkVolumeRayCastCompositeFunction
*rcf=vtkVolumeRayCastCompositeFunction::New();<br>
volumemapper->SetVolumeRayCastFunction(rcf);<br>
volumemapper->SetInput(img1->GetOutput());<br>
vol->SetMapper(volumemapper); <br><br> vtkCamera
*cam=vtkCamera::New();<br> cam->SetViewUp(0,0,-1);<br>
cam->SetPosition(0,1,0);<br>
cam->SetFocalPoint(0,0,0);<br>
cam->ComputeViewPlaneNormal();<br><br>
arenderer->AddActor(vol);<br>
arenderer->SetActiveCamera(cam);<br>
arenderer->ResetCamera();<br>
arenderer->SetBackground(1,1,1);<br> <br>
renwin->AddRenderer(arenderer);<br> vtkRenderWindowInteractor
*iren=vtkRenderWindowInteractor::New(); <br>
iren->SetRenderWindow(renwin);<br> renwin->Render();<br>
iren->Initialize();<br> iren->Start();<br><br>
img1->Delete();<br> iren->Delete();<br>}<br>--------<br>I would
really appreciate if anyone can help me. <br><br>Regards,<br>Ashish<br><br>
<div><span class="gmail_quote">On 9/7/06, <b class="gmail_sendername">Sharwari
Mavalankar</b> <<a href="mailto:sharwari@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> sharwari@gmail.com</a>>
wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div>hi Yixun,</div>
<div>I'll try and look into why the volume appears darker.</div>
<div> </div>
<div>However I'll there are many lines that are appearing on the volume
(they look like striations).</div>
<div>Do you know what the reason for that could be?</div>
<div> </div>
<div> </div>
<div>Also if I have to visualize color bmp slices (24 bit ) I need
<font face="Bookman Old Style">vtkFixedPointVolumeRayCastMapper
right?</font></div>
<div><font face="Bookman Old Style">Thanks </font></div></div>
<div><span>
<div><font face="Bookman Old Style">Sharwari</font><br><br> </div></span></div>
<div><span>
<div><span class="gmail_quote">On 9/6/06, <b class="gmail_sendername">Yixun
Liu</b> <<a href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">yxliu@fudan.edu.cn</a> >
wrote: </span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div>
<div bgcolor="#ffffff">
<div><font face="Bookman Old Style">Hi,</font></div>
<div><font face="Bookman Old Style">You are right and alwayse taking mm
as the unit.</font></div>
<div><font face="Bookman Old Style">SpacingX = 5.12*10/256;</font></div>
<div><font face="Bookman Old Style">SpacingY = 5.12*10/256;</font></div>
<div> </div>
<div><font face="Bookman Old Style">Many reason can make the volume look
darker.</font></div>
<div><font face="Bookman Old Style">You can change the opacity and
color interpolation function to adjust the appearance of the volume. If
you use shade you can also change ambient or diffusion coefficient
to make the volume look more lighter. Another method is to change
the <a>vtkLight</a> in the renderer. <a>vtkLight</a> is a virtual light
for 3D rendering. It provides methods to locate and point the light,
turn it on and off, and set its brightness and color. </font></div>
<div> </div>
<div><font face="Bookman Old Style">Cheers,</font></div></div>
<div><span>
<div> </div>
<div><font face="Bookman Old Style">Yixun Liu</font></div></span></div>
<div></div>
<div><span>
<div>----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><b>From:</b>
<a title="sharwari@gmail.com" href="mailto:sharwari@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Sharwari Mavalankar</a>
</div>
<div><b>To:</b> <a title="yxliu@fudan.edu.cn" href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Yixun Liu</a> </div>
<div><b>Cc:</b> <a title="vtkusers@vtk.org" href="mailto:vtkusers@vtk.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">VTK</a> </div></span></div>
<div><span>
<div><b>Sent:</b> Thursday, September 07, 2006 1:43 AM</div>
<div><b>Subject:</b> Re: Re: Re: Creating a Volume from 2D BMP
files.</div>
<div><br> </div>
<div>hi Yixun,</div>
<div>Thank you very much for your email.</div>
<div>What exactly do you mean by the physical size of the image?</div>
<div>Does it mean the size of the image in cm or mm?</div>
<div> </div>
<div>For example if my original images are 5.12 cm * 5.12 cm and are 256
* 256 images.</div>
<div>What will the data spacing be?</div>
<div> </div>
<div> </div>
<div>Also can you tell me the reason why the 3D volume seems darker than
the original images? </div>
<div>Is there any way I can scale the intensity of the images?</div>
<div>Thanks again,</div>
<div>Sharwari<br><br> </div>
<div><span class="gmail_quote">On 9/3/06, <b class="gmail_sendername">Yixun
Liu</b> <<a href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">yxliu@fudan.edu.cn</a>
> wrote: </span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div>
<div bgcolor="#ffffff">
<div><font face="Bookman Old Style">Hi,</font></div>
<div><font face="Bookman Old Style">If you read color bmp files you
should update vtk to 5.0 version and use
vtkFixedPointVolumeRayCastMapper(see last mail). Otherwise, you should
not call</font></div>
<div><font face="Bookman Old Style">br->SetNumberOfScalarComponents(3);</font></div>
<div> </div>
<div><font face="Bookman Old Style">1. You can decide the physical
spacing accroding to the image extent(pixel unit) and its physical
size(mm): spacing = size/(extent-1); If no physical size you have to
give a estimation for the spacing. </font></div>
<div> </div>
<div><font face="Bookman Old Style">2.The point1 and point2 will
define a linear opacity function, which can be interpolated from the
two points. For example, define two points (intensity1, opacity1)and
(intensity2, opacity2) you can get the opacity3 at intensity3 by
opacity3 =
(intensity3-intensity1)/(intensity2-intensity1)*(opacity2-opacity1) +
opacity1 </font></div>
<div> </div>
<div><font face="Bookman Old Style">Hope it help.</font></div>
<div> </div>
<div><font face="Bookman Old Style">Cheers,</font></div></div>
<div><span>
<div> </div>
<div><font face="Bookman Old Style"><span name="st">Yixun</span>
Liu</font></div>
<div><font face="Bookman Old Style"><br></font></div></span></div>
<div></div>
<div><span>
<div>----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><b>From:</b>
<a title="sharwari@gmail.com" href="mailto:sharwari@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Sharwari Mavalankar</a>
</div>
<div><b>To:</b> <a title="yxliu@fudan.edu.cn" href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"><span name="st">Yixun</span> Liu</a> </div>
<div><b>Cc:</b> <a title="vtkusers@vtk.org" href="mailto:vtkusers@vtk.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">VTK</a>
</div></span></div>
<div><span>
<div><b>Sent:</b> Monday, September 04, 2006 6:50 AM</div>
<div><b>Subject:</b> Re: Re: Creating a Volume from 2D BMP
files.</div>
<div><br> </div>
<div>hi Yixun,</div>
<div>I implemented the suggestions that you had made.</div>
<div>Now I am getting a 3D volume but it doesnt look anything like the
original 2D slices.</div>
<div>It is much darker in appearance and it's got lines all over it (
it looks as though it's some kind of aliasing).</div>
<div> </div>
<div>I have the following questions to ask you </div>
<div>1.While using the function SetDataSpacing(x,y,z) how do I decide
the values of the parameters x,y and z.</div>
<div> </div>
<div>2.While using the Addpoint() function of class
vtkPiecewiseFunction what do the two parameters in the Addpoint
function mean?</div>
<div>How do they affect the output?</div>
<div> </div>
<div> </div>
<div>This is code I have used. Do let me know if you can make any more
sugestions.</div>
<div> </div>
<div> </div>
<div>
<p>//This program reads a single BMP file and plots it as an
image.<br>//The same program will be extended to read multiple images
and create a 3D volume out of 2D slices.</p>
<p><br>#include "vtkRenderer.h"<br>#include
"vtkRenderWindow.h"<br>#include
"vtkRenderWindowInteractor.h"<br>#include "vtkBMPReader.h"<br>#include
"vtkPolyDataMapper.h"<br>#include "vtkActor.h"<br>#include
"vtkActor2D.h"<br>#include "vtkImageActor.h"<br>#include
"vtkOutlineFilter.h"<br>#include "vtkCamera.h"<br>#include
"vtkProperty.h" <br>#include "vtkPolyDataNormals.h"<br>#include
"vtkContourFilter.h"<br>#include "vtkDataSetMapper.h"<br>#include
"vtkImageMapper.h"<br>#include "vtkVolumeMapper.h"<br>#include "
vtkVolumeRayCastMapper.h"<br>#include
"vtkVolumeRayCastCompositeFunction.h"<br>#include
"vtkPiecewiseFunction.h"<br>#include "vtkVolumeProperty.h"</p>
<p><br>void main (void)<br>{<br> <br> vtkRenderer *aRenderer
= vtkRenderer::New();<br> vtkRenderWindow *renWin =
vtkRenderWindow::New();<br>
<br> renWin->AddRenderer(aRenderer);<br>
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
<br> iren->SetRenderWindow(renWin);</p>
<p><br> //create an instance of the class
vtkBMPReader<br> vtkBMPReader *br =
vtkBMPReader::New();<br> <br> br->SetFilePrefix("C:\\Images\\conductivities\\slice");
<br> br->SetFilePattern("%s%d.bmp");
<br> br->SetFileNameSliceOffset(1);<br> br->SetFileNameSliceSpacing(1);<br> br->SetNumberOfScalarComponents(3);<br> br->SetDataSpacing(0.4,0.4,10);<br> br->SetDataOrigin(0,0,0);<br> br->SetDataExtent(0,255,0,255,0,7);
<br> br->Update();<br> <br>
vtkPiecewiseFunction *opacityTransferFunction =
vtkPiecewiseFunction::New();<br> opacityTransferFunction->AddPoint(20,0.2);<br> opacityTransferFunction->AddPoint(255,1.0);</p>
<p> vtkVolumeProperty *volumeProperty =
vtkVolumeProperty::New();<br> volumeProperty->SetScalarOpacity(opacityTransferFunction);<br> </p>
<p><br> <br> vtkVolumeRayCastMapper *VolumeMapper =
vtkVolumeRayCastMapper::New();<br>
vtkVolumeRayCastCompositeFunction *RayCastFunction =
vtkVolumeRayCastCompositeFunction::New();<br>
VolumeMapper->SetVolumeRayCastFunction(RayCastFunction);
<br>
VolumeMapper->SetInput(br->GetOutput());</p>
<p> <br> vtkVolume *volume =
vtkVolume::New();<br> <br>
VolumeMapper->SetInput(br->GetOutput());<br>
volume->SetMapper(VolumeMapper);</p>
<p> vtkCamera *aCamera =
vtkCamera::New();<br> aCamera->SetViewUp (0,
0,-1);<br> aCamera->SetPosition (0, 1,
0);<br> aCamera->SetFocalPoint (0, 0,
0);<br> aCamera->ComputeViewPlaneNormal();</p>
<p><br> aRenderer->AddActor(volume);<br> aRenderer->SetActiveCamera(aCamera);<br>
aRenderer->ResetCamera
();<br> aRenderer->SetBackground(1,1,1);<br> renWin->Render();<br> <br>
iren->Initialize(); <br> iren->Start();
<br> <br>}</p></div>
<div> </div>
<div>Thanks again for all your help.</div>
<div>Sharwari<br><br> </div>
<div><span class="gmail_quote">On 8/31/06, <b class="gmail_sendername">Yixun Liu</b> <<a href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">yxliu@fudan.edu.cn
</a>> wrote: </span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div>
<div bgcolor="#ffffff">
<div><font face="Bookman Old Style">Hi,</font></div>
<div><font face="Bookman Old Style">Assuming image is 256x256x100.
The first file name is image1 and the last file name is image100.
So, SetDataExtent(0, 255, 0, 255, 1, 100); The access violation may
be caused by wrong extent setting. </font></div>
<div> </div>
<div><font face="Bookman Old Style">If you use vtkVolume, use
vtkVolumeRayCastMapper(vtk4.2.2) or use
vtkFixedPointVolumeRayCastMapper(vtk5.0). Note that if you use
vtkFixedPointVolumeRayCastMapper you no need to call
SetVolumeRayCastFunction(); </font></div>
<div> </div>
<div><font face="Bookman Old Style">Hope it help.</font></div></div>
<div><span>
<div> </div>
<div><font face="Bookman Old Style"><span name="st">Yixun</span>
Liu</font></div></span></div>
<div><span>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><b>From:</b>
<a title="sharwari@gmail.com" href="mailto:sharwari@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Sharwari
Mavalankar</a> </div>
<div><b>To:</b> <a title="yxliu@fudan.edu.cn" href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Yixun Liu</a>
</div>
<div><b>Cc:</b> <a title="vtkusers@vtk.org" href="mailto:vtkusers@vtk.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">VTK</a> </div>
<div><b>Sent:</b> Thursday, August 31, 2006 6:37 PM</div>
<div><b>Subject:</b> Re: Creating a Volume from 2D BMP
files.</div>
<div><br> </div>
<div>hi Yixun,</div>
<div>Thanks for your email.I had a couple of more questions
though.</div>
<div>1.I do not want to visualize colour slices.They are grey
level images.</div>
<div> </div>
<div>2.Also if I put SetDataExtent() before the Update() then I am
getting an access violation error.What does the Update function do
exactly?</div>
<div>Also can you tell me what the five parameters in
SetDataExtent() mean?</div>
<div> </div>
<div>3.If I use vtkVolume what mapper should I use to visualize
the slices?</div>
<div> </div>
<div> </div>
<div>Thanks again for all your help.</div>
<div>Sharwari</div>
<div><br><br> </div>
<div><span class="gmail_quote">On 8/23/06, <b class="gmail_sendername">Yixun Liu</b> <<a href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">yxliu@fudan.edu.cn
</a>> wrote: </span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div>
<div bgcolor="#ffffff">
<div><font face="Bookman Old Style">Hi,</font></div>
<div> </div>
<div><font face="Bookman Old Style">If you want to visualize
color slices, you need to </font></div>
<div><font face="Bookman Old Style">1. read these slices. You
need to put the SetDataExtent(0, 111, 0, 127, 1, 300);<br>before
Update();</font></div>
<div> </div>
<div><font face="Bookman Old Style"> vtkTIFFReader *v16 =
vtkTIFFReader::New();<br></font><font face="Bookman Old Style"> v16->SetFilePrefix("D:\\MyVC\\VTKtest\\Raycasting\\Data\\BrainColor\\brain");<br> v16->SetFilePattern("%s%d.TIF");
<br> v16->SetDataExtent(0, 111, 0, 127, 1,
300);<br> v16->SetDataSpacing(1.2,1.2,0.5);<br> v16->SetDataOrigin(0.0,
0.0, 0.0);</font></div>
<div><font face="Bookman Old Style"> v16->SetNumberOfScalarComponents(3);<br></font><font face="Bookman Old Style"> v16->Update();</font></div>
<div> </div>
<div><font face="Bookman Old Style">2. Add the 4th component.
The first three components are color and the 4th is used to map
to opacity. I compute the luminancy according to the firft three
components and take it as the 4th component. </font></div>
<div> </div>
<div><font face="Bookman Old Style">3. Opacity map using
vtkPiecewiseFunction</font></div>
<div> </div>
<div><font face="Bookman Old Style">4. no need color map
function</font></div>
<div> </div>
<div><font face="Bookman Old Style">5. you need
vtk5.0</font></div>
<div> </div>
<div><font face="Bookman Old Style">Regads,</font></div>
<div> </div>
<div><font face="Bookman Old Style"><span name="st">Yixun</span>
Liu</font></div>
<div><br> </div>
<div> </div></div></div></blockquote></div><br></blockquote></span></div></div></blockquote></div><br></span></div>
<div></div></div></blockquote></div><br></span></div>
<div></div></div></blockquote></div><br></span></div><br>_______________________________________________<br>This
is the private VTK discussion list.<br>Please keep messages on-topic.
Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to
subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtkusers
</a><br><br><br></blockquote></div><br></span></div>
<div><pre><hr size="4" width="90%"></pre></div>
<div><span>_______________________________________________ This is
the private VTK discussion list. Please keep messages on-topic. Check the
FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/Wiki/VTK_FAQ</a> Follow this link to
subscribe/unsubscribe: <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtkusers</a> </span></div>
<div></div></div></blockquote></div><br></blockquote></span></div><div></div>
</div></blockquote></div><br>