<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><font face="Bookman Old Style">Sharwari</font><br><br> </div>
<div><span class="gmail_quote">On 9/6/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="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<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><font face="Bookman Old Style"></font> </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><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 Liu</font></div></span></div>
<div>
<blockquote style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"></blockquote></div>
<div><span class="q">
<div>----- Original Message ----- </div>
<div style="BACKGROUND: #e4e4e4"><b>From:</b> <a title="sharwari@gmail.com" onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:sharwari@gmail.com" target="_blank">Sharwari Mavalankar</a> </div>
<div><b>To:</b> <a title="yxliu@fudan.edu.cn" onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:yxliu@fudan.edu.cn" target="_blank">Yixun Liu</a> </div>
<div><b>Cc:</b> <a title="vtkusers@vtk.org" onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:vtkusers@vtk.org" target="_blank">VTK</a> </div></span></div>
<div><span class="e" id="q_10d85c534ca208da_4">
<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><font face="Bookman Old Style"></font><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><font face="Bookman Old Style"></font> </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 onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:yxliu@fudan.edu.cn" target="_blank">yxliu@fudan.edu.cn</a>> wrote:
</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<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><font face="Bookman Old Style"></font> </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><font face="Bookman Old Style"></font> </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><font face="Bookman Old Style"></font> </div>
<div><font face="Bookman Old Style">Hope it help.</font></div>
<div><font face="Bookman Old Style"></font> </div>
<div><font face="Bookman Old Style">Cheers,</font></div></div>
<div><span>
<div><font face="Bookman Old Style"></font> </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>
<blockquote style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"></blockquote></div>
<div><span>
<div>----- Original Message ----- </div>
<div style="BACKGROUND: #e4e4e4"><b>From:</b> <a title="sharwari@gmail.com" onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:sharwari@gmail.com" target="_blank">Sharwari Mavalankar</a> </div>
<div><b>To:</b> <a title="yxliu@fudan.edu.cn" onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:yxliu@fudan.edu.cn" target="_blank"><span name="st">Yixun</span> Liu</a> </div>
<div><b>Cc:</b> <a title="vtkusers@vtk.org" onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:vtkusers@vtk.org" target="_blank">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 onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:yxliu@fudan.edu.cn" target="_blank">yxliu@fudan.edu.cn</a>> wrote:
</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<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><font face="Bookman Old Style"></font> </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><font face="Bookman Old Style"></font> </div>
<div><font face="Bookman Old Style">Hope it help.</font></div></div>
<div><span>
<div><font face="Bookman Old Style"></font> </div>
<div><font face="Bookman Old Style"><span name="st">Yixun</span> Liu</font></div></span></div>
<div><span>
<blockquote style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<div>----- Original Message ----- </div>
<div style="BACKGROUND: #e4e4e4"><b>From:</b> <a title="sharwari@gmail.com" onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:sharwari@gmail.com" target="_blank">Sharwari Mavalankar</a> </div>
<div><b>To:</b> <a title="yxliu@fudan.edu.cn" onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:yxliu@fudan.edu.cn" target="_blank">Yixun Liu</a> </div>
<div><b>Cc:</b> <a title="vtkusers@vtk.org" onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:vtkusers@vtk.org" target="_blank">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 onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:yxliu@fudan.edu.cn" target="_blank">yxliu@fudan.edu.cn</a>> wrote:
</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div bgcolor="#ffffff">
<div><font face="Bookman Old Style">Hi,</font></div>
<div><font face="Bookman Old Style"></font> </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><font face="Bookman Old Style"></font> </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><font face="Bookman Old Style"></font> </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><font face="Bookman Old Style"></font> </div>
<div><font face="Bookman Old Style">3. Opacity map using vtkPiecewiseFunction</font></div>
<div><font face="Bookman Old Style"></font> </div>
<div><font face="Bookman Old Style">4. no need color map function</font></div>
<div><font face="Bookman Old Style"></font> </div>
<div><font face="Bookman Old Style">5. you need vtk5.0</font></div>
<div><font face="Bookman Old Style"></font> </div>
<div><font face="Bookman Old Style">Regads,</font></div>
<div><font face="Bookman Old Style"></font> </div>
<div><font face="Bookman Old Style"><span name="st">Yixun</span> Liu</font></div>
<div><br> </div>
<div><font face="Bookman Old Style"></font> </div></div></div></blockquote></div><br></blockquote></span></div>
<div></div></div></blockquote></div><br></span></div>
<div>
<blockquote></blockquote></div></div></blockquote></div><br></span></div>
<div>
<blockquote></blockquote></div></div></blockquote></div><br>