<html><body bgcolor="#FFFFFF"><div>Hi Elena,</div><div><br></div><div>you might be interested in reading the basics of filters and data representation in ITK in the itkSoftwareGuide.</div><div><br></div><div>Image filters take input images and produce output images (well, sources have no inputs and mappers/sinks no outputs). Images are the data structures. An image can either be created manually, filled with proper values and then passed to a filter as input or it is an output of another filter and then set as input of a consecutive filter. Thus, SetInput() and GetOutput() are methods of filters but clearly not of images.</div><div><br></div><div>To connect two filters, do something like</div><div><br></div><div>filter2->SetInput( filter1->GetOutput() );</div><div><br></div><div>or to set a manually created image as input of a filter</div><div><br></div><div>filter->SetInput( image );</div><div><br></div><div>To get the output image, just call</div><div><br></div><div>image = filter->GetOutput();</div><div><br></div><div> <br>As it seems that you have your image data in a continuous C array, you should consider using the itk::ImportImageFilter. This filter gives you as output the appropriate itk::Image, where no copying of the pixel data is necessary.</div><div><br></div><div>Then set the output of this filter as input of the itk::ConnectedThresholdImageFilter.</div><div><br></div><div>To get the output image use just the following code</div><div><br></div><div>OutputImage = filter->GetOutput();</div><div><br></div><div>--</div><div>regards</div><div>Andreas</div><div><br>On Jul 3, 2009, at 8:18 PM, Elena Molina <<a href="mailto:elenam85@gmail.com">elenam85@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>Hi,<br> I´m trying to apply the algorithm "connected threshold" in my image. I have this error:<br><br>RegionGrowing.cc(75) : error C2039: 'GetOutput' : is not a member of 'Image<float,3>'<br>
RegionGrowing.cc(76) : error C2039: 'SetInput' : is not a member of 'Image<float,3>'<br><br>My code is:<br><br><br><br> int x = volSize[0];<br> int y = volSize[1];<br> int z = volSize[2];<br>
<br> vector<float> res = volSize.mm; <br> <br> float dx = res[0];<br> float dy = res[0];<br> float dz = res[0];<br><br> typedef itk::Image<float,3> ImageType; <br> ImageType::Pointer InputImage = ImageType::New();<br>
ImageType::Pointer OutputImage = ImageType::New();<br><br> ImageType::SizeType size;<br> size[0] = x; <br> size[1] = y; <br> size[2] = z; <br><br> ImageType::IndexType start;<br> start[0] = 0; <br>
start[1] = 0; <br> start[2] = 0; <br> <br> ImageType::RegionType region;<br> region.SetSize( size );<br> region.SetIndex( start );<br><br> InputImage->SetRegions( region);<br> InputImage->Allocate(); <br>
<br> float spacing[3];<br> spacing[0] = res[0];<br> spacing[1] = res[1];<br> spacing[2] = res[2];<br><br> InputImage->SetSpacing(<div id=":xf" class="ii gt">spacing);<br><br> typedef itk::ImageRegionIterator<ImageType> IteratorType;<br>
IteratorType it(InputImage, region);<br> <br> const float *data=subdata;<br> it.GoToBegin();<br> while(!it.IsAtEnd())<br> {<br> it.Set (*data);<br> ++it;<br> ++data;<br> }<br> <br>
<br> typedef itk::ConnectedThresholdImageFilter<ImageType,ImageType> FilterType;<br> FilterType::Pointer filter = FilterType::New(); <br><br> filter->SetInput(InputImage->GetOutput());<br> OutputImage->SetInput(filter->GetOutput());<br>
<br><br> How can I resolve it?<br><br>Regards, <br>Elena<br></div><br><br><div class="gmail_quote">2009/7/3 Elena Molina <span dir="ltr"><<a href="mailto:elenam85@gmail.com"><a href="mailto:elenam85@gmail.com">elenam85@gmail.com</a></a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>First of all, I´m working with DICOM images in an already programmed (C++) application. Now I want to introduce<br>new features in this application and I´ll use ITK libraries.<br>So... my problem now is how can I convert my image (actually I have my image in memory (3D) and I have the<br>
pointer to the first position of this image) in a compliant format for using it with ITK functions.<br>I was reading in the getting started V how can I integrating ITK in my application and tried to do the same example but It <br>
didn´t work.<br>How can I do it? Which parameters I need? Pointer in the first position, size... any more?<br><br>Thankssssss<br>
</blockquote></div><br>
</div></blockquote><blockquote type="cite"><div><span>_____________________________________</span><br><span>Powered by <a href="http://www.kitware.com"><a href="http://www.kitware.com">www.kitware.com</a></a></span><br><span></span><br><span>Visit other Kitware open-source projects at</span><br><span><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a></span><br><span></span><br><span>Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ"><a href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a></a></span><br><span></span><br><span>Follow this link to subscribe/unsubscribe:</span><br><span><a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a></span><br></div></blockquote></body></html>