[Insight-users] 3D Segmentation Mask

Cameron Burnett w_e_b_m_a_s_t_e_r_6_9 at hotmail.com
Tue May 6 08:27:42 EDT 2008


Hi all,

I've been working on my problem, and I fixed a few things but it still does nothing.

The part that I changed is as follows. I had forgotten to change the physical coordinates to indices, so thats what I've done here. Its output is shown below the code.

-------

InternalImageType::Pointer image = reader->GetOutput();

  InternalImageType::PointType origin;
  origin[0] = 0.0;
  origin[1] = 0.0;
  origin[2] = 0.0;
  image->SetOrigin(origin);

    image->TransformPhysicalPointToIndex(startPt, start);
    image->TransformPhysicalPointToIndex(endPt, end);

  InternalImageType::SizeType size;
  size[0] = (int)end[0]-(int)start[0];
  size[1] = (int)end[1]-(int)start[1]; 
  size[2] = (int)end[2]-(int)start[2];

        CString v;
    v.Format("%i %i %i %i %i %i",start[0],start[1],start[2],size[0],size[1],size[2]);
    AfxMessageBox(v);

------

The output of that last message box shows the start coords and the size coords. That outputs "239 179 229 134 68 51". Now to me that sounds fine. My image is 512 x 512 x 342 so its within that, and also the size is quite small, which is exactly what I did with my box widget.

I'm not forgetting to refresh the screen or anything. All I have done is add this filter into the pipeline, and the rest is the same as when it worked previously with no masking.

Anything obviously wrong with my code??

Thanks,
Cameron.



From: w_e_b_m_a_s_t_e_r_6_9 at hotmail.com
To: luis.ibanez at kitware.com
Date: Tue, 6 May 2008 00:24:10 +1000
CC: insight-users at itk.org
Subject: Re: [Insight-users] 3D Segmentation Mask







Thanks for that info Luis. 


I implemented the box widget approach today and it seems to mask quite well, because the time it takes to run is drastically reduced. However I'm not actually getting anything to display on the screen.

I'm using the ImageReadRegionOfInterestWrite example, and the key section of code is as follows.

-------------------------------------------------------------------------

  vtkPolyData *poly = vtkPolyData::New();

  double bounds[6];
  for(int i=0; i<6; i++){bounds[i] = NULL;}

  boxWidget->GetPolyData(poly);
  poly->GetBounds(bounds);

//then i set up the filter

  InternalImageType::IndexType start;
  start[0] = (int)bounds[0]; //xmin   
  start[1] = (int)bounds[2]; //ymin
  start[2] = (int)bounds[4]; //zmin

  InternalImageType::SizeType size;
  size[0] = (int)(bounds[1]-bounds[0]);    //xmax-xmin
  size[1] = (int)(bounds[3]-bounds[2]);  //etc...
  size[2] = (int)(bounds[5]-bounds[4]);

//then i attach it all together, add it to the pipeline etc.

--------------------------------------------------------------------------------

I think my problem has something to do with the Start and Size indices. I'm not sure what i'm doing wrong though.


Thanks for any further help,
Cameron.




> Date: Wed, 30 Apr 2008 16:56:25 -0400
> From: luis.ibanez at kitware.com
> To: w_e_b_m_a_s_t_e_r_6_9 at hotmail.com
> CC: insight-users at itk.org
> Subject: Re: [Insight-users] 3D Segmentation Mask
> 
> Hi Cameron,
> 
> It seems that what you are looking for is a VTK interactive
> method for selecting a region of interest of your 3D image,
> that will be later passed to an ITK segmentation pipeline.
> 
> Is that correct ?
> 
> If so, one thing you could easily use is the
> 
>        vtkAffineWidget
> http://www.vtk.org/doc/nightly/html/classvtkAffineWidget.html
> 
> or the
> 
>        vtkBoxWidget
> http://www.vtk.org/doc/nightly/html/classvtkBoxWidget.html
> 
> or a combination of 3 ImagePlaneWidgets:
> http://www.vtk.org/doc/nightly/html/classvtkImagePlaneWidget.html
> 
> 
> That you will find the widgets under
> 
> 
>                  VTK/Widgets/
> 
> 
> You could interactively manipulate their handles until you have
> captured the region of interest and then (programatically)
> you could query the current state of the widget in order to
> deduce the coordinates of its corners.
> 
> The coordinate of the region of interest could then be passed
> as a Region to the itkRegionOfInterestImageFilter.
> 
> 
> 
> 
>      Regards,
> 
> 
>         Luis
> 
> 
> 
> ----------------------
> Cameron Burnett wrote:
> > Hi,
> > 
> > Currently I'm trying to figure out how to create a mask for 
> > segmentation. The way i'm thinking of doing it is using a 
> > MaskImageFilter to mask my DICOM object with a vtkActor cube object that 
> > I generated just from points. To do that I need to figure out 1 of 2 
> > things (due to the fact that you can't plug an actor straight into the 
> > mask filter). Either I replace that vtkActor with some sort of ITK box 
> > primitive that can go straight into the filter, OR I somehow convert the 
> > object into the correct itk image form.
> > 
> > Does that make sense?? Generally I just want to segment only the stuff 
> > inside a box that I can move around. That's the simple way of putting it.
> > 
> > I was looking at this example in the Insight Applications  
> > "vtkPolyDataToITKMesh.cxx" , but I'm not sure thats what I'm after. Also 
> > I found a bit on the mailing list about 
> > "TriangleMeshToBinaryImageFilter" but that has just left me even more 
> > confused.
> > 
> > Is there an easier way to create an interactive/movable/scaleable 3D 
> > mask, other than a cube represented by a vtkActor? What sort of stuff 
> > should I be looking to use for this approach (or a similar one) ??
> > 
> > Thanks in advance,
> > Cameron.
> > 
> > 
> > 
> > 
> > 
> > ------------------------------------------------------------------------
> > Click here Search for local singles online @ Lavalife. 
> > <http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D30290&_t=764581033&_r=email_taglines_Search_OCT07&_m=EXT>
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users

Find out: SEEK Salary Centre Are you paid what you're worth?

_________________________________________________________________
Never miss another e-mail with Hotmail on your mobile.
http://www.livelife.ninemsn.com.au/article.aspx?id=343869
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080506/649f20dc/attachment-0001.htm>


More information about the Insight-users mailing list