<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Bookman Old Style">Hi,</FONT></DIV>
<DIV>vtkVolumeRayCastMapper&nbsp; does not support short type, so rescale it to 
unsigned short using vtkImageShiftScale&nbsp; or use 
vtkFixedPointVolumeRayCastMapper instead of vtkVolumeRayCastMapper.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">Hope it help.</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">Yixun</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 9pt &#23435;&#20307;">----- Original Message ----- </DIV>
  <DIV style="BACKGROUND: #e4e4e4; FONT: 9pt &#23435;&#20307;; font-color: black"><B>From:</B> 
  <A title=mrasingh@gmail.com href="mailto:mrasingh@gmail.com">Ashish Singh</A> 
  </DIV>
  <DIV style="FONT: 9pt &#23435;&#20307;"><B>To:</B> <A title=yxliu@fudan.edu.cn 
  href="mailto:yxliu@fudan.edu.cn">Yixun Liu</A> ; <A title=vtkusers@vtk.org 
  href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
  <DIV style="FONT: 9pt &#23435;&#20307;"><B>Sent:</B> Thursday, September 14, 2006 1:02 
  PM</DIV>
  <DIV style="FONT: 9pt &#23435;&#20307;"><B>Subject:</B> Re: [vtkusers] Re: Re: Re: Creating 
  a Volume from 2D BMP files.</DIV>
  <DIV><BR></DIV>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>&nbsp; <BR>&nbsp; vtkRenderer *arenderer = 
  vtkRenderer::New();<BR>&nbsp; vtkRenderWindow *renwin = 
  vtkRenderWindow::New();<BR>&nbsp; vtkDICOMImageReader 
  *img1=vtkDICOMImageReader::New(); <BR><BR>&nbsp; 
  img1-&gt;SetFilePrefix("D:\\testimages\\dicomset\\IM");<BR>&nbsp; 
  img1-&gt;SetFilePattern("%s%d.dcm");<BR>&nbsp; 
  img1-&gt;SetFileNameSliceOffset(1);<BR>&nbsp; 
  img1-&gt;SetFileNameSliceSpacing(1);<BR>&nbsp; 
  img1-&gt;SetDataExtent(0,511,0,511,1,10);//512x512 images and 10 slices 
  <BR>&nbsp; img1-&gt;SetDataSpacing(360.0/512,360.0/512,1.0); //my image is 
  36cm x 36cm and 512x512<BR>&nbsp; 
  img1-&gt;SetDataOrigin(0.0,0.0,0.0);<BR>&nbsp; 
  img1-&gt;Update();<BR><BR>&nbsp; vtkVolume *vol=vtkVolume::New();<BR>&nbsp; 
  vtkVolumeRayCastMapper *volumemapper = vtkVolumeRayCastMapper::New(); 
  <BR>&nbsp; vtkVolumeRayCastCompositeFunction 
  *rcf=vtkVolumeRayCastCompositeFunction::New();<BR>&nbsp; 
  volumemapper-&gt;SetVolumeRayCastFunction(rcf);<BR>&nbsp; 
  volumemapper-&gt;SetInput(img1-&gt;GetOutput());<BR>&nbsp; 
  vol-&gt;SetMapper(volumemapper); <BR><BR>&nbsp; vtkCamera 
  *cam=vtkCamera::New();<BR>&nbsp; cam-&gt;SetViewUp(0,0,-1);<BR>&nbsp; 
  cam-&gt;SetPosition(0,1,0);<BR>&nbsp; cam-&gt;SetFocalPoint(0,0,0);<BR>&nbsp; 
  cam-&gt;ComputeViewPlaneNormal();<BR><BR>&nbsp; 
  arenderer-&gt;AddActor(vol);<BR>&nbsp; 
  arenderer-&gt;SetActiveCamera(cam);<BR>&nbsp; 
  arenderer-&gt;ResetCamera();<BR>&nbsp; 
  arenderer-&gt;SetBackground(1,1,1);<BR>&nbsp; <BR>&nbsp; 
  renwin-&gt;AddRenderer(arenderer);<BR>&nbsp; vtkRenderWindowInteractor 
  *iren=vtkRenderWindowInteractor::New(); <BR>&nbsp; 
  iren-&gt;SetRenderWindow(renwin);<BR>&nbsp; renwin-&gt;Render();<BR>&nbsp; 
  iren-&gt;Initialize();<BR>&nbsp; iren-&gt;Start();<BR><BR>&nbsp; 
  img1-&gt;Delete();<BR>&nbsp; iren-&gt;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> &lt;<A href="mailto:yxliu@fudan.edu.cn">yxliu@fudan.edu.cn</A>&gt; 
  wrote:</SPAN>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
    <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>&nbsp;</DIV>
    <DIV><FONT face="Bookman Old Style">Cheers,</FONT></DIV></DIV>
    <DIV><SPAN class=sg>
    <DIV><FONT face="Bookman Old Style"></FONT>&nbsp;</DIV>
    <DIV><FONT face="Bookman Old Style">Yixun</FONT></DIV></SPAN></DIV>
    <DIV><SPAN class=e id=q_10da9c15c887d41a_2>
    <BLOCKQUOTE 
    style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
      <DIV>----- Original Message ----- </DIV>
      <DIV 
      style="BACKGROUND: rgb(228,228,228) 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 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="mailto:mrasingh@gmail.com" target=_blank>Ashish Singh</A> </DIV>
      <DIV><B>To:</B> <A title=vtkusers@vtk.org 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="mailto:vtkusers@vtk.org" target=_blank>vtkusers@vtk.org</A> </DIV>
      <DIV><B>Cc:</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> ; <A 
      title=amy.squillacote@kitware.com 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="mailto:amy.squillacote@kitware.com" target=_blank>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>&nbsp; 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>&nbsp; 
      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> &lt;<A 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="mailto:amy.squillacote@kitware.com" 
      target=_blank>amy.squillacote@kitware.com</A>&gt; wrote:</SPAN> 
      <BLOCKQUOTE class=gmail_quote 
      style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
        <DIV>
        <DIV bgcolor="#ffffff" text="#000000">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>&nbsp;(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>&nbsp; <BR>&nbsp; vtkRenderer *arenderer = 
        vtkRenderer::New();<BR>&nbsp; vtkRenderWindow *renwin = 
        vtkRenderWindow::New();<BR>&nbsp; vtkDICOMImageReader 
        *img1=vtkDICOMImageReader::New(); <BR><BR>&nbsp; 
        img1-&gt;SetFilePrefix("D:\\testimages\\dicomset\\IM");<BR>&nbsp; 
        img1-&gt;SetFilePattern("%s%d.dcm");<BR>&nbsp; 
        img1-&gt;SetFileNameSliceOffset(1);<BR>&nbsp; 
        img1-&gt;SetFileNameSliceSpacing(1);<BR>&nbsp; 
        img1-&gt;SetDataExtent(0,511,0,511,1,10);//512x512 images and 10 slices 
        <BR>&nbsp; img1-&gt;SetDataSpacing(360.0/512,360.0/512,1.0); //my image 
        is 36cm x 36cm and 512x512<BR>&nbsp; 
        img1-&gt;SetDataOrigin(0.0,0.0,0.0);<BR>&nbsp; 
        img1-&gt;Update();<BR><BR>&nbsp; vtkVolume 
        *vol=vtkVolume::New();<BR>&nbsp; vtkVolumeRayCastMapper *volumemapper = 
        vtkVolumeRayCastMapper::New(); <BR>&nbsp; 
        vtkVolumeRayCastCompositeFunction 
        *rcf=vtkVolumeRayCastCompositeFunction::New();<BR>&nbsp; 
        volumemapper-&gt;SetVolumeRayCastFunction(rcf);<BR>&nbsp; 
        volumemapper-&gt;SetInput(img1-&gt;GetOutput());<BR>&nbsp; 
        vol-&gt;SetMapper(volumemapper); <BR><BR>&nbsp; vtkCamera 
        *cam=vtkCamera::New();<BR>&nbsp; cam-&gt;SetViewUp(0,0,-1);<BR>&nbsp; 
        cam-&gt;SetPosition(0,1,0);<BR>&nbsp; 
        cam-&gt;SetFocalPoint(0,0,0);<BR>&nbsp; 
        cam-&gt;ComputeViewPlaneNormal();<BR><BR>&nbsp; 
        arenderer-&gt;AddActor(vol);<BR>&nbsp; 
        arenderer-&gt;SetActiveCamera(cam);<BR>&nbsp; 
        arenderer-&gt;ResetCamera();<BR>&nbsp; 
        arenderer-&gt;SetBackground(1,1,1);<BR>&nbsp; <BR>&nbsp; 
        renwin-&gt;AddRenderer(arenderer);<BR>&nbsp; vtkRenderWindowInteractor 
        *iren=vtkRenderWindowInteractor::New(); <BR>&nbsp; 
        iren-&gt;SetRenderWindow(renwin);<BR>&nbsp; 
        renwin-&gt;Render();<BR>&nbsp; iren-&gt;Initialize();<BR>&nbsp; 
        iren-&gt;Start();<BR><BR>&nbsp; img1-&gt;Delete();<BR>&nbsp; 
        iren-&gt;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> &lt;<A 
        onclick="return top.js.OpenExtLink(window,event,this)" 
        href="mailto:sharwari@gmail.com" target=_blank> 
        sharwari@gmail.com</A>&gt; wrote:</SPAN> 
        <BLOCKQUOTE class=gmail_quote 
        style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
          <DIV>
          <DIV>hi Yixun,</DIV>
          <DIV>I'll try and look into why the volume appears darker.</DIV>
          <DIV>&nbsp;</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>&nbsp;</DIV>
          <DIV>&nbsp;</DIV>
          <DIV>Also if I have to visualize color bmp slices (24 bit )&nbsp;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>&nbsp;</DIV></SPAN></DIV>
          <DIV><SPAN>
          <DIV><SPAN class=gmail_quote>On 9/6/06, <B 
          class=gmail_sendername>Yixun Liu</B> &lt;<A 
          onclick="return top.js.OpenExtLink(window,event,this)" 
          href="mailto:yxliu@fudan.edu.cn" target=_blank>yxliu@fudan.edu.cn</A> 
          &gt; wrote: </SPAN>
          <BLOCKQUOTE class=gmail_quote 
          style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 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>&nbsp;</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&nbsp;change the opacity 
            and color interpolation function to adjust the appearance of the 
            volume. If you use shade you can also&nbsp;change ambient or 
            diffusion coefficient to make the volume look&nbsp;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>&nbsp;</DIV>
            <DIV><FONT face="Bookman Old Style">Cheers,</FONT></DIV></DIV>
            <DIV><SPAN>
            <DIV>&nbsp;</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) 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 
            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>
            <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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
            <DIV>&nbsp;</DIV>
            <DIV>Also can you tell me the reason why the 3D volume seems darker 
            than the original images?&nbsp;</DIV>
            <DIV>Is there any way I can scale the intensity of the images?</DIV>
            <DIV>Thanks again,</DIV>
            <DIV>Sharwari<BR><BR>&nbsp;</DIV>
            <DIV><SPAN class=gmail_quote>On 9/3/06, <B 
            class=gmail_sendername>Yixun Liu</B> &lt;<A 
            onclick="return top.js.OpenExtLink(window,event,this)" 
            href="mailto:yxliu@fudan.edu.cn" 
            target=_blank>yxliu@fudan.edu.cn</A> &gt; wrote: </SPAN>
            <BLOCKQUOTE class=gmail_quote 
            style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 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-&gt;SetNumberOfScalarComponents(3);</FONT></DIV>
              <DIV>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
              <DIV><FONT face="Bookman Old Style">Hope it help.</FONT></DIV>
              <DIV>&nbsp;</DIV>
              <DIV><FONT face="Bookman Old Style">Cheers,</FONT></DIV></DIV>
              <DIV><SPAN>
              <DIV>&nbsp;</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) 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 
              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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
              <DIV>2.While using the Addpoint() &nbsp;function of class 
              vtkPiecewiseFunction what do the two parameters in the Addpoint 
              function mean?</DIV>
              <DIV>How do they affect the output?</DIV>
              <DIV>&nbsp;</DIV>
              <DIV>&nbsp;</DIV>
              <DIV>This is code I have used. Do let me know if you can make any 
              more sugestions.</DIV>
              <DIV>&nbsp;</DIV>
              <DIV>&nbsp;</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>&nbsp;<BR>&nbsp;vtkRenderer 
              *aRenderer = vtkRenderer::New();<BR>&nbsp;&nbsp;&nbsp; 
              vtkRenderWindow *renWin = 
              vtkRenderWindow::New();<BR>&nbsp;&nbsp;&nbsp; 
              <BR>&nbsp;renWin-&gt;AddRenderer(aRenderer);<BR>&nbsp;&nbsp;&nbsp; 
              vtkRenderWindowInteractor *iren = 
              vtkRenderWindowInteractor::New(); <BR>&nbsp;&nbsp;&nbsp; 
              iren-&gt;SetRenderWindow(renWin);</P>
              <P><BR>&nbsp;//create an instance of the class 
              vtkBMPReader<BR>&nbsp;vtkBMPReader *br = 
              vtkBMPReader::New();<BR>&nbsp;<BR>&nbsp;br-&gt;SetFilePrefix("C:\\Images\\conductivities\\slice"); 
              <BR>&nbsp;br-&gt;SetFilePattern("%s%d.bmp"); 
              <BR>&nbsp;br-&gt;SetFileNameSliceOffset(1);<BR>&nbsp;br-&gt;SetFileNameSliceSpacing(1);<BR>&nbsp;br-&gt;SetNumberOfScalarComponents(3);<BR>&nbsp;br-&gt;SetDataSpacing(0.4,0.4,10);<BR>&nbsp;br-&gt;SetDataOrigin(0,0,0);<BR>&nbsp;br-&gt;SetDataExtent(0,255,0,255,0,7); 
              <BR>&nbsp;br-&gt;Update();<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; 
              vtkPiecewiseFunction *opacityTransferFunction = 
              vtkPiecewiseFunction::New();<BR>&nbsp;opacityTransferFunction-&gt;AddPoint(20,0.2);<BR>&nbsp;opacityTransferFunction-&gt;AddPoint(255,1.0);</P>
              <P>&nbsp;vtkVolumeProperty *volumeProperty = 
              vtkVolumeProperty::New();<BR>&nbsp;volumeProperty-&gt;SetScalarOpacity(opacityTransferFunction);<BR>&nbsp;</P>
              <P><BR>&nbsp;<BR>&nbsp;vtkVolumeRayCastMapper *VolumeMapper = 
              vtkVolumeRayCastMapper::New();<BR>&nbsp;&nbsp;&nbsp; 
              vtkVolumeRayCastCompositeFunction *RayCastFunction = 
              vtkVolumeRayCastCompositeFunction::New();<BR>&nbsp;&nbsp;&nbsp; 
              VolumeMapper-&gt;SetVolumeRayCastFunction(RayCastFunction); 
              <BR>&nbsp;&nbsp;&nbsp; 
              VolumeMapper-&gt;SetInput(br-&gt;GetOutput());</P>
              <P>&nbsp;&nbsp;&nbsp; <BR>&nbsp;vtkVolume *volume = 
              vtkVolume::New();<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; 
              VolumeMapper-&gt;SetInput(br-&gt;GetOutput());<BR>&nbsp;&nbsp; 
              volume-&gt;SetMapper(VolumeMapper);</P>
              <P>&nbsp;&nbsp;&nbsp; vtkCamera *aCamera = 
              vtkCamera::New();<BR>&nbsp;&nbsp;&nbsp; aCamera-&gt;SetViewUp (0, 
              0,-1);<BR>&nbsp;&nbsp;&nbsp; aCamera-&gt;SetPosition (0, 1, 
              0);<BR>&nbsp;&nbsp;&nbsp; aCamera-&gt;SetFocalPoint (0, 0, 
              0);<BR>&nbsp;&nbsp;&nbsp; 
aCamera-&gt;ComputeViewPlaneNormal();</P>
              <P><BR>&nbsp;&nbsp;aRenderer-&gt;AddActor(volume);<BR>&nbsp;aRenderer-&gt;SetActiveCamera(aCamera);<BR>&nbsp;&nbsp;&nbsp; 
              aRenderer-&gt;ResetCamera 
              ();<BR>&nbsp;aRenderer-&gt;SetBackground(1,1,1);<BR>&nbsp;renWin-&gt;Render();<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; 
              iren-&gt;Initialize(); <BR>&nbsp;&nbsp;&nbsp; iren-&gt;Start(); 
              <BR>&nbsp;<BR>}</P></DIV>
              <DIV>&nbsp;</DIV>
              <DIV>Thanks again for all your help.</DIV>
              <DIV>Sharwari<BR><BR>&nbsp;</DIV>
              <DIV><SPAN class=gmail_quote>On 8/31/06, <B 
              class=gmail_sendername>Yixun Liu</B> &lt;<A 
              onclick="return top.js.OpenExtLink(window,event,this)" 
              href="mailto:yxliu@fudan.edu.cn" target=_blank>yxliu@fudan.edu.cn 
              </A>&gt; wrote: </SPAN>
              <BLOCKQUOTE class=gmail_quote 
              style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 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>&nbsp;</DIV>
                <DIV><FONT face="Bookman Old Style">If you use vtkVolume, use 
                vtkVolumeRayCastMapper(vtk4.2.2) or&nbsp;use 
                vtkFixedPointVolumeRayCastMapper(vtk5.0). Note that if you use 
                vtkFixedPointVolumeRayCastMapper you no need to call 
                SetVolumeRayCastFunction(); </FONT></DIV>
                <DIV>&nbsp;</DIV>
                <DIV><FONT face="Bookman Old Style">Hope it 
                help.</FONT></DIV></DIV>
                <DIV><SPAN>
                <DIV>&nbsp;</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: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
                  <DIV>----- Original Message ----- </DIV>
                  <DIV 
                  style="BACKGROUND: rgb(228,228,228) 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 
                  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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
                  <DIV>3.If I use vtkVolume what mapper should I use to 
                  visualize the slices?</DIV>
                  <DIV>&nbsp;</DIV>
                  <DIV>&nbsp;</DIV>
                  <DIV>Thanks again for all your help.</DIV>
                  <DIV>Sharwari</DIV>
                  <DIV><BR><BR>&nbsp;</DIV>
                  <DIV><SPAN class=gmail_quote>On 8/23/06, <B 
                  class=gmail_sendername>Yixun Liu</B> &lt;<A 
                  onclick="return top.js.OpenExtLink(window,event,this)" 
                  href="mailto:yxliu@fudan.edu.cn" 
                  target=_blank>yxliu@fudan.edu.cn </A>&gt; wrote: </SPAN>
                  <BLOCKQUOTE class=gmail_quote 
                  style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
                    <DIV>
                    <DIV bgcolor="#ffffff">
                    <DIV><FONT face="Bookman Old Style">Hi,</FONT></DIV>
                    <DIV>&nbsp;</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>&nbsp;</DIV>
                    <DIV><FONT face="Bookman Old Style">&nbsp;vtkTIFFReader *v16 
                    = vtkTIFFReader::New();<BR></FONT><FONT 
                    face="Bookman Old Style">&nbsp;v16-&gt;SetFilePrefix("D:\\MyVC\\VTKtest\\Raycasting\\Data\\BrainColor\\brain");<BR>&nbsp;v16-&gt;SetFilePattern("%s%d.TIF"); 
                    <BR>&nbsp;v16-&gt;SetDataExtent(0, 111, 0, 127, 1, 
                    300);<BR>&nbsp;v16-&gt;SetDataSpacing(1.2,1.2,0.5);<BR>&nbsp;v16-&gt;SetDataOrigin(0.0, 
                    0.0, 0.0);</FONT></DIV>
                    <DIV><FONT 
                    face="Bookman Old Style">&nbsp;v16-&gt;SetNumberOfScalarComponents(3);<BR></FONT><FONT 
                    face="Bookman Old Style">&nbsp;v16-&gt;Update();</FONT></DIV>
                    <DIV>&nbsp;</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>&nbsp;</DIV>
                    <DIV><FONT face="Bookman Old Style">3. Opacity map using 
                    vtkPiecewiseFunction</FONT></DIV>
                    <DIV>&nbsp;</DIV>
                    <DIV><FONT face="Bookman Old Style">4. no need color map 
                    function</FONT></DIV>
                    <DIV>&nbsp;</DIV>
                    <DIV><FONT face="Bookman Old Style">5. you need 
                    vtk5.0</FONT></DIV>
                    <DIV>&nbsp;</DIV>
                    <DIV><FONT face="Bookman Old Style">Regads,</FONT></DIV>
                    <DIV>&nbsp;</DIV>
                    <DIV><FONT face="Bookman Old Style"><SPAN 
                    name="st">Yixun</SPAN> Liu</FONT></DIV>
                    <DIV><BR>&nbsp;</DIV>
                    <DIV>&nbsp;</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 
          onclick="return top.js.OpenExtLink(window,event,this)" 
          href="http://www.vtk.org/Wiki/VTK_FAQ" 
          target=_blank>http://www.vtk.org/Wiki/VTK_FAQ</A><BR>Follow this link 
          to subscribe/unsubscribe:<BR><A 
          onclick="return top.js.OpenExtLink(window,event,this)" 
          href="http://www.vtk.org/mailman/listinfo/vtkusers" 
          target=_blank>http://www.vtk.org/mailman/listinfo/vtkusers 
          </A><BR><BR><BR></BLOCKQUOTE></DIV><BR></SPAN></DIV>
        <DIV><PRE><HR width="90%" SIZE=4></PRE></DIV>
        <DIV><SPAN>_______________________________________________ This is the 
        private VTK discussion list. Please keep messages on-topic. Check the 
        FAQ at: <A onclick="return top.js.OpenExtLink(window,event,this)" 
        href="http://www.vtk.org/Wiki/VTK_FAQ" 
        target=_blank>http://www.vtk.org/Wiki/VTK_FAQ</A> Follow this link to 
        subscribe/unsubscribe: <A 
        onclick="return top.js.OpenExtLink(window,event,this)" 
        href="http://www.vtk.org/mailman/listinfo/vtkusers" 
        target=_blank>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></BLOCKQUOTE></BODY></HTML>