<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'><div style="text-align: left;"><br>Thanks Luis, that almost worked. I was concentrating so much on the box widget I didn't really think to change the seed point.<br><br>The problem now is seen in the following 2 pictures.<br><br>This is the dicom object I get from the box widget mask. IE: the area that I want to segment..... http://img169.imageshack.us/img169/1506/femurunsegmentedjx1.jpg<br>And this is the result.... http://img254.imageshack.us/img254/2503/femursegmenteden8.jpg<br><br>You can see that the result is actually not quite the area that we were after. Its moved up in the +Z direction so that most of the femur is actually cut off. I'm almost certain that this is because the Z axis is flipped or something similar. But why? One would presume that the TransformPhysicalPointToIndex function would give the correct index even if the Z axis was somehow the wrong way around, right?<br><br>Naturally, I just changed the Z starting point to start on the other side.....<br><br> start[2] = 512 - start[2]; // hardcoded 512 as a test <br> size[2] = start[2]-end[2]; //changed from size[2] = end[2]-start[2];<br><br>.... however the program just crashed when I did that.<br><br><br>I'm wondering if this problem is a bug, because it seems really strange to me that the points don't translate properly. Do you think it might be, or is it just another simple fix that I'm overlooking??<br><br>Thanks.<br></div><br><div></div><br><br><hr id="stopSpelling">> Date: Wed, 7 May 2008 12:01:49 -0400<br>> From: luis.ibanez@kitware.com<br>> To: w_e_b_m_a_s_t_e_r_6_9@hotmail.com<br>> CC: insight-users@itk.org<br>> Subject: Re: [Insight-users] 3D Segmentation Mask<br>> <br>> <br>> <br>> Hi Cameron,<br>> <br>> <br>> Your suspicion is probably right,<br>> <br>> <br>> If you have the following pipeline:<br>> <br>> <br>> reader-->ROIFilter-->RegionGrow<br>> <br>> <br>> and you feed the RegionGrowing filter<br>> with seed points whose index coordinates<br>> have been taken from the input image of<br>> the ROIFilter, then those indices can<br>> easily be outside of the extent of the<br>> image used in the RegionGrow filter.<br>> <br>> <br>> For example,<br>> <br>> if the input image has a region:<br>> <br>> Index Start: 0, 0, 0<br>> Size: 512, 512, 200<br>> <br>> and you extract the ROI;<br>> <br>> Index Start: 200, 200, 50<br>> Size : 100, 100, 100<br>> <br>> you will end up with an image whose<br>> region is given by:<br>> <br>> Index Start: 0, 0, 0<br>> Size: 100, 100, 100<br>> <br>> the Origin coordinates will be computed in<br>> order to match the physical position of the<br>> index (200,200,50) in the input image.<br>> <br>> <br>> So... if you are picking the seed points<br>> from the input image you have to convert<br>> these indices to the range of the output<br>> image.<br>> <br>> For example:<br>> <br>> Index picked in the input image:<br>> <br>> 257, 234, 65<br>> <br>> should be converted to the ROI extracted<br>> image by subtracting the origin of the<br>> ROI<br>> <br>> 257-200, 234-200, 65-50<br>> <br>> to produce<br>> <br>> 57, 34, 15<br>> <br>> <br>> You could also prevent crashes by testing<br>> the index before running the algorithm.<br>> <br>> <br>> For example:<br>> <br>> roi->Update();<br>> if( roi->GetOutput()->GetBufferedRegion().IsInside( seed ) )<br>> {<br>> regionGrowth->AddSeed( seed );<br>> regionGrowth->Update();<br>> }<br>> else<br>> {<br>> // error message<br>> }<br>> <br>> <br>> Note tha you must call Update() in the roi filter<br>> before you attempt to query its output image.<br>> <br>> <br>> Please let us know if you find any other problems,<br>> <br>> <br>> Thanks<br>> <br>> <br>> Luis<br>> <br>> -----------------------<br>> Cameron Burnett wrote:<br>> > <br>> > I've done a bit of testing to see where my problem is.<br>> > <br>> > 1) The region that I've set up (to define the <br>> > RegionOfInterestImageFilter) is definately within the input image range.<br>> > 2) The Confidence Connected seed point is definately within the defined <br>> > region.<br>> > <br>> > So in that regard everything seems perfect. Now I'm also getting another <br>> > result where the program crashes, presumably because of a bad pixel <br>> > index given to the Confidence Connected Filter....<br>> > <br>> > const InputRealType seedIntensity =<br>> > static_cast<InputRealType>(inputImage->GetPixel( *si )); <br>> > //crashes here in itkConfidenceConnectedImageFilter.txx<br>> > <br>> > <br>> > .... and so now I'm thinking that maybe the RegionOfInterestImageFilter <br>> > has set up a whole new pixel index system, but my program is still using <br>> > the old one perhaps?<br>> > <br>> > Does this filter use the same pixel indices as the original image or <br>> > does it create new ones within the new region?? Thats honestly the ONLY <br>> > thing I can think of.<br>> > <br>> > Thanks.<br>> > <br>> > <br>> > <br>> > <br>> > <br>> > ------------------------------------------------------------------------<br>> > From: w_e_b_m_a_s_t_e_r_6_9@hotmail.com<br>> > To: w_e_b_m_a_s_t_e_r_6_9@hotmail.com<br>> > CC: insight-users@itk.org<br>> > Subject: RE: [Insight-users] 3D Segmentation Mask<br>> > Date: Tue, 6 May 2008 22:27:42 +1000<br>> > <br>> > Hi all,<br>> > <br>> > I've been working on my problem, and I fixed a few things but it<br>> > still does nothing.<br>> > <br>> > The part that I changed is as follows. I had forgotten to change the<br>> > physical coordinates to indices, so thats what I've done here. Its<br>> > output is shown below the code.<br>> > <br>> > -------<br>> > <br>> > InternalImageType::Pointer image = reader->GetOutput();<br>> > <br>> > InternalImageType::PointType origin;<br>> > origin[0] = 0.0;<br>> > origin[1] = 0.0;<br>> > origin[2] = 0.0;<br>> > image->SetOrigin(origin);<br>> > <br>> > image->TransformPhysicalPointToIndex(startPt, start);<br>> > image->TransformPhysicalPointToIndex(endPt, end);<br>> > <br>> > InternalImageType::SizeType size;<br>> > size[0] = (int)end[0]-(int)start[0];<br>> > size[1] = (int)end[1]-(int)start[1];<br>> > size[2] = (int)end[2]-(int)start[2];<br>> > <br>> > CString v;<br>> > v.Format("%i %i %i %i %i<br>> > %i",start[0],start[1],start[2],size[0],size[1],size[2]);<br>> > AfxMessageBox(v);<br>> > <br>> > ------<br>> > <br>> > The output of that last message box shows the start coords and the<br>> > size coords. That outputs "239 179 229 134 68 51". Now to me that<br>> > sounds fine. My image is 512 x 512 x 342 so its within that, and<br>> > also the size is quite small, which is exactly what I did with my<br>> > box widget.<br>> > <br>> > I'm not forgetting to refresh the screen or anything. All I have<br>> > done is add this filter into the pipeline, and the rest is the same<br>> > as when it worked previously with no masking.<br>> > <br>> > Anything obviously wrong with my code??<br>> > <br>> > Thanks,<br>> > Cameron.<br>> > <br>> > <br>> > <br>> > ------------------------------------------------------------------------<br>> > From: w_e_b_m_a_s_t_e_r_6_9@hotmail.com<br>> > To: luis.ibanez@kitware.com<br>> > Date: Tue, 6 May 2008 00:24:10 +1000<br>> > CC: insight-users@itk.org<br>> > Subject: Re: [Insight-users] 3D Segmentation Mask<br>> > <br>> > Thanks for that info Luis.<br>> > <br>> > <br>> > I implemented the box widget approach today and it seems to mask<br>> > quite well, because the time it takes to run is drastically<br>> > reduced. However I'm not actually getting anything to display on<br>> > the screen.<br>> > <br>> > I'm using the ImageReadRegionOfInterestWrite example, and the<br>> > key section of code is as follows.<br>> > <br>> > -------------------------------------------------------------------------<br>> > <br>> > vtkPolyData *poly = vtkPolyData::New();<br>> > <br>> > double bounds[6];<br>> > for(int i=0; i<6; i++){bounds[i] = NULL;}<br>> > <br>> > boxWidget->GetPolyData(poly);<br>> > poly->GetBounds(bounds);<br>> > <br>> > //then i set up the filter<br>> > <br>> > InternalImageType::IndexType start;<br>> > start[0] = (int)bounds[0]; //xmin <br>> > start[1] = (int)bounds[2]; //ymin<br>> > start[2] = (int)bounds[4]; //zmin<br>> > <br>> > InternalImageType::SizeType size;<br>> > size[0] = (int)(bounds[1]-bounds[0]); //xmax-xmin<br>> > size[1] = (int)(bounds[3]-bounds[2]); //etc...<br>> > size[2] = (int)(bounds[5]-bounds[4]);<br>> > <br>> > //then i attach it all together, add it to the pipeline etc.<br>> > <br>> > --------------------------------------------------------------------------------<br>> > <br>> > I think my problem has something to do with the Start and Size<br>> > indices. I'm not sure what i'm doing wrong though.<br>> > <br>> > <br>> > Thanks for any further help,<br>> > Cameron.<br>> > <br>> > <br>> > <br>> > <br>> > ------------------------------------------------------------------------<br>> > > Date: Wed, 30 Apr 2008 16:56:25 -0400<br>> > > From: luis.ibanez@kitware.com<br>> > > To: w_e_b_m_a_s_t_e_r_6_9@hotmail.com<br>> > > CC: insight-users@itk.org<br>> > > Subject: Re: [Insight-users] 3D Segmentation Mask<br>> > ><br>> > > Hi Cameron,<br>> > ><br>> > > It seems that what you are looking for is a VTK interactive<br>> > > method for selecting a region of interest of your 3D image,<br>> > > that will be later passed to an ITK segmentation pipeline.<br>> > ><br>> > > Is that correct ?<br>> > ><br>> > > If so, one thing you could easily use is the<br>> > ><br>> > > vtkAffineWidget<br>> > > http://www.vtk.org/doc/nightly/html/classvtkAffineWidget.html<br>> > ><br>> > > or the<br>> > ><br>> > > vtkBoxWidget<br>> > > http://www.vtk.org/doc/nightly/html/classvtkBoxWidget.html<br>> > ><br>> > > or a combination of 3 ImagePlaneWidgets:<br>> > > http://www.vtk.org/doc/nightly/html/classvtkImagePlaneWidget.html<br>> > ><br>> > ><br>> > > That you will find the widgets under<br>> > ><br>> > ><br>> > > VTK/Widgets/<br>> > ><br>> > ><br>> > > You could interactively manipulate their handles until you have<br>> > > captured the region of interest and then (programatically)<br>> > > you could query the current state of the widget in order to<br>> > > deduce the coordinates of its corners.<br>> > ><br>> > > The coordinate of the region of interest could then be passed<br>> > > as a Region to the itkRegionOfInterestImageFilter.<br>> > ><br>> > ><br>> > ><br>> > ><br>> > > Regards,<br>> > ><br>> > ><br>> > > Luis<br>> > ><br>> > ><br>> > ><br>> > > ----------------------<br>> > > Cameron Burnett wrote:<br>> > > > Hi,<br>> > > ><br>> > > > Currently I'm trying to figure out how to create a mask for<br>> > > > segmentation. The way i'm thinking of doing it is using a<br>> > > > MaskImageFilter to mask my DICOM object with a vtkActor<br>> > cube object that<br>> > > > I generated just from points. To do that I need to figure<br>> > out 1 of 2<br>> > > > things (due to the fact that you can't plug an actor<br>> > straight into the<br>> > > > mask filter). Either I replace that vtkActor with some sort<br>> > of ITK box<br>> > > > primitive that can go straight into the filter, OR I<br>> > somehow convert the<br>> > > > object into the correct itk image form.<br>> > > ><br>> > > > Does that make sense?? Generally I just want to segment<br>> > only the stuff<br>> > > > inside a box that I can move around. That's the simple way<br>> > of putting it.<br>> > > ><br>> > > > I was looking at this example in the Insight Applications<br>> > > > "vtkPolyDataToITKMesh.cxx" , but I'm not sure thats what<br>> > I'm after. Also<br>> > > > I found a bit on the mailing list about<br>> > > > "TriangleMeshToBinaryImageFilter" but that has just left me<br>> > even more<br>> > > > confused.<br>> > > ><br>> > > > Is there an easier way to create an<br>> > interactive/movable/scaleable 3D<br>> > > > mask, other than a cube represented by a vtkActor? What<br>> > sort of stuff<br>> > > > should I be looking to use for this approach (or a similar<br>> > one) ??<br>> > > ><br>> > > > Thanks in advance,<br>> > > > Cameron.<br>> > > ><br>> > > ><br>> > > ><br>> > > ><br>> > > ><br>> > > ><br>> > ------------------------------------------------------------------------<br>> > > > Click here Search for local singles online @ Lavalife.<br>> > > ><br>> > <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><br>> > > ><br>> > > ><br>> > > ><br>> > ------------------------------------------------------------------------<br>> > > ><br>> > > > _______________________________________________<br>> > > > Insight-users mailing list<br>> > > > Insight-users@itk.org<br>> > > > http://www.itk.org/mailman/listinfo/insight-users<br>> > <br>> > ------------------------------------------------------------------------<br>> > Find out: SEEK Salary Centre Are you paid what you're worth?<br>> > <http://a.ninemsn.com.au/b.aspx?URL=http://ninemsn.seek.com.au/career-resources/salary-centre/?tracking%3Dsk:het:sc:nine:0:hot:text&_t=764565661&_r=OCT07_endtext_salary&_m=EXT><br>> > <br>> > <br>> > <br>> > ------------------------------------------------------------------------<br>> > Hotmail on your mobile. Never miss another e-mail with<br>> > <http://www.livelife.ninemsn.com.au/article.aspx?id=343869> <br>> > <br>> > <br>> > ------------------------------------------------------------------------<br>> > at CarPoint.com.au It's simple! Sell your car for just $30 <br>> > <http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&_t=762955845&_r=tig_OCT07&_m=EXT><br>> > <br>> > <br>> > ------------------------------------------------------------------------<br>> > <br>> > _______________________________________________<br>> > Insight-users mailing list<br>> > Insight-users@itk.org<br>> > http://www.itk.org/mailman/listinfo/insight-users<br><br /><hr />Find out: SEEK Salary Centre <a href='http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2Fcareer%2Dresources%2Fsalary%2Dcentre%2F%3Ftracking%3Dsk%3Ahet%3Asc%3Anine%3A0%3Ahot%3Atext&_t=764565661&_r=OCT07_endtext_salary&_m=EXT' target='_new'>Are you paid what you're worth?</a></body>
</html>