<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;">Hi all,<br><br>I've been working on my problem, and I fixed a few things but it still does nothing.<br><br>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.<br><br>-------<br><br>InternalImageType::Pointer image = reader-&gt;GetOutput();<br><br>&nbsp; InternalImageType::PointType origin;<br>&nbsp; origin[0] = 0.0;<br>&nbsp; origin[1] = 0.0;<br>&nbsp; origin[2] = 0.0;<br>&nbsp; image-&gt;SetOrigin(origin);<br><br>&nbsp;&nbsp;&nbsp; image-&gt;TransformPhysicalPointToIndex(startPt, start);<br>&nbsp;&nbsp;&nbsp; image-&gt;TransformPhysicalPointToIndex(endPt, end);<br><br>&nbsp; InternalImageType::SizeType size;<br>&nbsp; size[0] = (int)end[0]-(int)start[0];<br>&nbsp; size[1] = (int)end[1]-(int)start[1]; <br>&nbsp; size[2] = (int)end[2]-(int)start[2];<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CString v;<br>&nbsp;&nbsp;&nbsp; v.Format("%i %i %i %i %i %i",start[0],start[1],start[2],size[0],size[1],size[2]);<br>&nbsp;&nbsp;&nbsp; AfxMessageBox(v);<br><br>------<br><br>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.<br><br>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.<br><br>Anything obviously wrong with my code??<br><br>Thanks,<br>Cameron.<br></div><br><div></div><br><br><blockquote><hr id="EC_stopSpelling">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>

<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">
<style>
.ExternalClass .EC_hmmessage P
{padding:0px;}
.ExternalClass body.EC_hmmessage
{font-size:10pt;font-family:Tahoma;}
</style>

<div style="text-align: left;">Thanks for that info Luis. <br><br><br>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.<br></div><br>I'm using the ImageReadRegionOfInterestWrite example, and the key section of code is as follows.<br><br>-------------------------------------------------------------------------<br><br>&nbsp; vtkPolyData *poly = vtkPolyData::New();<br><br>&nbsp; double bounds[6];<br>&nbsp; for(int i=0; i&lt;6; i++){bounds[i] = NULL;}<br><br>&nbsp; boxWidget-&gt;GetPolyData(poly);<br>&nbsp; poly-&gt;GetBounds(bounds);<br><br>//then i set up the filter<br><br>&nbsp; InternalImageType::IndexType start;<br>&nbsp; start[0] = (int)bounds[0]; //xmin&nbsp;&nbsp; <br>&nbsp; start[1] = (int)bounds[2]; //ymin<br>&nbsp; start[2] = (int)bounds[4]; //zmin<br><br>&nbsp; InternalImageType::SizeType size;<br>&nbsp; size[0] = (int)(bounds[1]-bounds[0]);&nbsp;&nbsp;  //xmax-xmin<br>&nbsp; size[1] = (int)(bounds[3]-bounds[2]);&nbsp; //etc...<br>&nbsp; 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 indices. I'm not sure what i'm doing wrong though.<br><br><br>Thanks for any further help,<br>Cameron.<br><div></div><br><br><br><br><hr id="EC_stopSpelling">&gt; Date: Wed, 30 Apr 2008 16:56:25 -0400<br>&gt; From: luis.ibanez@kitware.com<br>&gt; To: w_e_b_m_a_s_t_e_r_6_9@hotmail.com<br>&gt; CC: insight-users@itk.org<br>&gt; Subject: Re: [Insight-users] 3D Segmentation Mask<br>&gt; <br>&gt; Hi Cameron,<br>&gt; <br>&gt; It seems that what you are looking for is a VTK interactive<br>&gt; method for selecting a region of interest of your 3D image,<br>&gt; that will be later passed to an ITK segmentation pipeline.<br>&gt; <br>&gt; Is that correct ?<br>&gt; <br>&gt; If so, one thing you could easily use is the<br>&gt; <br>&gt;        vtkAffineWidget<br>&gt; http://www.vtk.org/doc/nightly/html/classvtkAffineWidget.html<br>&gt; <br>&gt; or the<br>&gt; <br>&gt;        vtkBoxWidget<br>&gt; http://www.vtk.org/doc/nightly/html/classvtkBoxWidget.html<br>&gt; <br>&gt; or a combination of 3 ImagePlaneWidgets:<br>&gt; http://www.vtk.org/doc/nightly/html/classvtkImagePlaneWidget.html<br>&gt; <br>&gt; <br>&gt; That you will find the widgets under<br>&gt; <br>&gt; <br>&gt;                  VTK/Widgets/<br>&gt; <br>&gt; <br>&gt; You could interactively manipulate their handles until you have<br>&gt; captured the region of interest and then (programatically)<br>&gt; you could query the current state of the widget in order to<br>&gt; deduce the coordinates of its corners.<br>&gt; <br>&gt; The coordinate of the region of interest could then be passed<br>&gt; as a Region to the itkRegionOfInterestImageFilter.<br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt;      Regards,<br>&gt; <br>&gt; <br>&gt;         Luis<br>&gt; <br>&gt; <br>&gt; <br>&gt; ----------------------<br>&gt; Cameron Burnett wrote:<br>&gt; &gt; Hi,<br>&gt; &gt; <br>&gt; &gt; Currently I'm trying to figure out how to create a mask for <br>&gt; &gt; segmentation. The way i'm thinking of doing it is using a <br>&gt; &gt; MaskImageFilter to mask my DICOM object with a vtkActor cube object that <br>&gt; &gt; I generated just from points. To do that I need to figure out 1 of 2 <br>&gt; &gt; things (due to the fact that you can't plug an actor straight into the <br>&gt; &gt; mask filter). Either I replace that vtkActor with some sort of ITK box <br>&gt; &gt; primitive that can go straight into the filter, OR I somehow convert the <br>&gt; &gt; object into the correct itk image form.<br>&gt; &gt; <br>&gt; &gt; Does that make sense?? Generally I just want to segment only the stuff <br>&gt; &gt; inside a box that I can move around. That's the simple way of putting it.<br>&gt; &gt; <br>&gt; &gt; I was looking at this example in the Insight Applications  <br>&gt; &gt; "vtkPolyDataToITKMesh.cxx" , but I'm not sure thats what I'm after. Also <br>&gt; &gt; I found a bit on the mailing list about <br>&gt; &gt; "TriangleMeshToBinaryImageFilter" but that has just left me even more <br>&gt; &gt; confused.<br>&gt; &gt; <br>&gt; &gt; Is there an easier way to create an interactive/movable/scaleable 3D <br>&gt; &gt; mask, other than a cube represented by a vtkActor? What sort of stuff <br>&gt; &gt; should I be looking to use for this approach (or a similar one) ??<br>&gt; &gt; <br>&gt; &gt; Thanks in advance,<br>&gt; &gt; Cameron.<br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt; Click here Search for local singles online @ Lavalife. <br>&gt; &gt; &lt;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&amp;_t=764581033&amp;_r=email_taglines_Search_OCT07&amp;_m=EXT&gt;<br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt; <br>&gt; &gt; _______________________________________________<br>&gt; &gt; Insight-users mailing list<br>&gt; &gt; Insight-users@itk.org<br>&gt; &gt; 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://ninemsn.seek.com.au/career-resources/salary-centre/?tracking%3Dsk:het:sc:nine:0:hot:text&amp;_t=764565661&amp;_r=OCT07_endtext_salary&amp;_m=EXT" target="_blank">Are you paid what you're worth?</a>
</blockquote><br /><hr />Hotmail on your mobile. <a href='http://www.livelife.ninemsn.com.au/article.aspx?id=343869' target='_new'>Never miss another e-mail with </a></body>
</html>