[IGSTK-Users] Receiving the image from Spatial Object

ionut iorgovan ionutcelgroaznic at yahoo.com
Mon May 28 12:36:18 EDT 2007


Hi Luis,
   
  I'm not sure if this can help other users and can be applied in other scenarios.
  I think if I explain it first will save us from the hustle and bustle.
  1)I started by reading two DICOM CT datasets.To display simultaneously two 2D slices at the same position basically I duplicate all the CT handling code.I have m_ImageReader1+m_ImageReader2;m_ImageSpatialObject1+m_ImageSpatialObject2;
  m_ImageRepresentationAxial1+m_ImageRepresentationAxial2 and so on.The only difference is that I set 
   
  m_ImageRepresentationAxial1->SetOpacity( 0.5 );
  m_ImageRepresentationAxial2->SetOpacity( 0.5 );
   
  This way I blend the two slices to get the appearance of one slice.
   
  2)In order to display a segmentation data in color I needed to modify the igstkImageSpatialObject but adding two methods:
  void SetPseudoColorGray(){
  m_LUT->SetTableRange ( (m_Level - m_Window/2.0), (m_Level + m_Window/2.0) );
  m_LUT->SetSaturationRange (0.0, 0.0);
  m_LUT->SetHueRange (0.0, 0.0);
  m_LUT->SetValueRange (0.0, 1.0);
  m_LUT->SetRampToLinear();
}
  void saSetPseudoColorRedBlue(){
  m_LUT->SetValueRange (1, 1);
  m_LUT->SetSaturationRange (1, 1);
  m_LUT->SetHueRange (0.677, 1.0);
  m_LUT->SetNumberOfColors(256);
  m_LUT->SetTableRange (0.0,255.0 );
  m_LUT->Build(); 
  m_LUT->SetTableValue(0, 0.0, 0.0, 0.0, 0.1);
  m_LUT->SetTableValue(1, 0.3, 1.0, 0.0, 0.5);
  m_LUT->SetTableValue(2, 1.0, 7.0, 0.5, 0.7);
  m_LUT->SetTableValue(3, 0.6, 0.3, 1.0, 0.7);
  m_LUT->SetTableValue(4, 0.5, 1.0, 0.5, 0.2);
}

  I call the first one after I create m_ImageRepresentationAxial1 for CT data and second one to color my tumor data in red(actualy my second data contains 1 for tumor,2 for entrypoint area,3 for safety margin around tumor,4 for no touch zone )
You presume by default that ImageSpatialobject should pseudocolor the data in gray scale.I think only CTImageSpatialobject  should do that.
   
  3)If I want to display the tumor contour basically I preprocess the segmentation data with a surface extraction algorithm that does the following:for each voxel that has the value 1 for tumor check his neighbours if they are background then I keep that voxel otherwise I discard it.
   
  4)I read all my segmentation data from an "planning file" that has the next format:
  #Number of entry points
1
#entry points
114.674 64.9553 44.9074   
#ablation radius in mm
40 
#Number of ablations
5   
# x y z
128.452 87.4343 35.4807
135.341 98.6738 30.7674
....
  and also I read separately segmentation file which is a binary file that has 0 for background,1 for tumor,2 for entry point.
   
  Inside the code I rasterize the spheres and combine the information with the segmentation file.
  I think probably an XML file that contains all this planning data with a special igstk reader that parses all this information will be more appropriate.
   
  In order to add these planning components to IGSK sandbox I have to write a basic XML Planning reader and an PlanningSpatialObject and PlanningSpatialObjectRepresentationAxial,PlanningSpatialObjectRepresentationSaggital,PlanningSpatialObjectRepresentation3D(this should display surfaces with transparency or by using raycasting).This PlanningSpatialObject should contain an 3D image that has different values for different components.
  I'm not sure how this can help and if it fits Igstk paradigm.
   
  For my application I found that Igstk provides only a simple surgical planning(entry point and target point).
   
  Teo


Luis Ibanez <luis.ibanez at kitware.com> wrote:  
Hi Ionut,


Thanks for letting us know of your results.
They look great.


1) You could have indeed used the vtkCut filter
and then follow it with the vtkDelaunay2D filter,
in order to generate a triangulation of the contour.
This will work fine as long as the contour is convex.


2) I would encourage you to share this class with the
community. We could rename it and put it in the
IGSTK Sandbox. If you found this class useful, it is
very likely that others will do so too. By sharing the
code, you will also benefit from improvements that other
may make to the class.


3) RequestSetImage() in the ImageSpatialObject is declared
private for safety reasons. The purpose is to ensure that
*only* image readers can put an image in an ImageSpatialObject.
That is, ImageReaders are the *only trusted* source of images.

Remember that the purpose of IGSTK is to provide image
guidance during a surgery. We don't expect that you are
going to do Image Segmentation in the middle of a surgery.

That will be overly optimistic, and border in irresponsible.

We anticipate that you will perform segmentation as part
of *planning* the surgery. (e.g. days or at least hours,
before the actual surgical intervention). You wil save
those segmentations as images or as meshes, and at the
time of the surgery you will only *read* those segmentation
into the scene.


Why is that your image is not being provided by a Reader ?



Please let us know,


Thanks


Luis



------------------------
ionut iorgovan wrote:
> Hi Luis,
> 
> I implemented this using my idea.The reason I didn't use vtkCut is I 
> dont think I can use vtkCut to display tumors except as contours not as 
> filled polygon.(Can I do that with vtkCut?)
> 
> _http://isiswiki.georgetown.edu/teo/rfacolor.jpg_
> __ 
> But I didn't implemented it as a separated 
> igstkImageContourSpatialObjectRepresentation as you suggested , I just 
> modified the igstkImageSpatialObjectRepresentation :(.(because only is 
> for my own usage)
> 
> My only concern is the RequestSetImage() method from 
> igstkImageSpatialObject require that my application is a friend of that 
> class.I dont understand why this method cannot be accessed directly ?
> 
> Teo
> 
> */Luis Ibanez /* wrote:
> 
> 
> Hi Teo,
> 
> Implementing this functionality by redrawing an image
> is a bit of an overkill. You can do it in a simpler
> way by using creating a new image representation class
> and using a vtkContour + a vtkCut filter inside.
> 
> 
> 1) You can implement this functionality as a new type
> of ImageRepresentation class.
> 
> 2) If you start from the current class:
> 
> igstkImageSpatialObjectRepresentation.
> 
> and create a new class, with (for example) name
> 
> igstkImageContourSpatialObjectRepresentation.
> 
> 3) Inside that new class you remove the
> 
> vtkImageActor
> vtkLookupTable
> vtkImageMapToColors
> 
> and replace them with a vtkContour filter and
> a normal vtkActor.
> 
> 
> 4) Then setup a similar pipeline to the one illustrated
> in the ITK example:
> 
> InsightApplications/Auxiliary/vtk
> itkReadITKImage3DSegmentShowVTK.cxx
> 
> 5) The image that you need to pass to the vtkContour filter
> is the vtkImageData that you get from the VTKImageObserver.
> 
> 
> 
> The reason behind the apparently complicated way of passing
> images is that IGSTK does not expose ITK or VTK classes in
> order to increase the safety of the software applications.
> 
> 
> The igstkImage class contains internally an ITK image, and
> using an ITK export + VTK import filter, it reuses the pixel
> data in order to create a vtkImageData object that you can
> pass to a VTK pipeline.
> 
> 
> 
> Please let us know if you find any difficulties implementing
> the igstkImageContourSpatialObjectRepresentation class.
> 
> 
> 
> Thanks
> 
> 
> 
> Luis
> 
> 
> 
> 
> ------------------------
> ionut iorgovan wrote:
> > Hi,
> >
> > I want to display the contour of a segmented object in
> Axial,Sagittal
> > and Coronal Views using igstk.
> > I saw there are implemented in IGSTK sandbox some classes that start
> > with Contour but they suport only mesh representation and also
> there is
> > no documentation how to use them, and what goes were.
> >
> > Therefore I tried to implement my own classes.
> > I wanted to display a second transparent slice(above the CT data)
> that
> > shows a rasterized contour rather than a 3d object.
> >
> > So I wrote my own SpatialObject and SpatialObjectRepresentation.
> > My workflow goes like this:
> > 1.Create an empty 3D image(vtk or itk) that has the same
> dimension like
> > CTSpatialObject internal image data.
> > 2.Draw my countours inside this image
> > 3.Pass the image to my SpatialObject in a similar fashion with
> > CTImageSpatialObject.
> >
> > My problem is the RequestGetITKImage() with afferent event
> > ITKImageModifiedEvent is not fully implemented so I
> > used RequestGetVTKImage() instead and then get the
> dimensions,spacing
> > from the vtk image and create a new itk image.
> >
> > My questions are
> > 1.How can I display contours in igstk(the book offers no clue on
> how I
> > can do this)?
> > 2.Why the class has a RequestGetITKImage() and no event
> > ITKImageModifiedEvent?
> > 3.What is the reason behind this very complicated way of passing
> image
> > data between classes?
> > 4.Is isgtk keeping an internal copy of the 3d data in each class?
> > 5.How a user is supposed to use correctly an Igstk
> > component(methods,event,states-look in constructor for allowed
> requests,
> > look for allowed events)?
> >
> > Teo
> >
> >
> ------------------------------------------------------------------------
> > Luggage? GPS? Comic books?
> > Check out fitting gifts for grads
> >
> > at Yahoo! Search.
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > IGSTK-Users mailing list
> > IGSTK-Users at public.kitware.com
> > http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users
> 
> 
> ------------------------------------------------------------------------
> Get your own web address. 
> 
> Have a HUGE year through Yahoo! Small Business. < 
> http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> IGSTK-Users mailing list
> IGSTK-Users at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users


       
---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20070528/53bd318a/attachment-0001.html>


More information about the IGSTK-Users mailing list