<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hello,<div><br></div><div>If you can't find an example, it's frequently useful to search through the test. Here is one that may be helpful:</div><div><a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/ImageSources/test/itkPhysicalPointImageSourceTest.cxx">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/ImageSources/test/itkPhysicalPointImageSourceTest.cxx</a></div><div><br></div><div>It's the bits not include in your code segment which aren't correct :)</div><div><br></div><div>From the doxygen[1]: "This image source supports image which have a multi-component pixel equal to the image dimension, and variable length VectorImages. It is recommented that the component type be a real valued type."</div><div><br></div><div>You have instantiated it with an itk::Image of unsigned char, while the filter expects a multi-component image. Such as an itk::Image of Point<float,3>, Index<int,3> or an itk::VectorImage<int, 3>. </div><div><br></div><div>Here is how I would do this in SimpleITK for Python:</div><div><br></div><div><div>import SimpleITK as sitk</div></div><div><br></div><div>img = sitk.Image([100,100,100], sitk.sitkUInt8)</div><div><br></div><div>idxImage = sitk.PhysicalPointSource(sitk.sitkVectorUInt32, size=img.GetSize())</div><div><br></div><div>zidxImage = sitk.VectorIndexSelectionCast(idxImage,2)</div><div><br></div><div>From here you can do some image arithmetic to encode both the original image label and slice index. Perhaps keeping the label id in the lower bits and the slice id in the upper.</div><div><br></div><div>Brad</div><div><br></div><div>[1] <a href="http://www.itk.org/Doxygen/html/classitk_1_1PhysicalPointImageSource.html">http://www.itk.org/Doxygen/html/classitk_1_1PhysicalPointImageSource.html</a></div><div><br><div><div>On May 23, 2014, at 10:26 AM, Sarah Basti <<a href="mailto:ahalabasti@hotmail.com">ahalabasti@hotmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr">I tried to do the following:<div><br></div><div>typedef itk::PhysicalPointImageSource<OutputImageType> physicalPointImageType;<br><span style="font-size: 12pt;">physicalPointImageType</span><span style="font-size: 12pt;">::Pointer physicalImage = </span>physicalPointImageType<span style="font-size: 12pt;">::New();</span><br><div style="margin: 0px; padding: 0px; text-indent: 0px;">physicalImage->SetSize(reader->GetOutput()-><span style="font-size: 12pt;">GetLargestPossibleRegion</span><span style="font-size: 12pt;">().GetSize());</span></div><br>physicalImage->Update();<br><br><br>I get this error though:<br><div><br><div>In file included from /home/Support/Slicer-SuperBuild-Release/ITKv4/Modules/Filtering/ImageSources/include/itkPhysicalPointImageSource.h:81:0,</div><div> from /home/acorvo/Desktop/SlicerModules/Cross-Section-Location/Source/CrossSectionLocation.cxx:18:</div><div><span style="font-size: 12pt;">/home/Support/</span>Slicer-SuperBuild-Release/ITKv4/Modules/Filtering/ImageSources/include/itkPhysicalPointImageSource.hxx: In member function ‘void itk::PhysicalPointImageSource<TOutputImage>::ThreadedGenerateData(const RegionType&, itk::ThreadIdType) [with TOutputImage = itk::Image<short unsigned int, 3u>, itk::PhysicalPointImageSource<TOutputImage>::RegionType = itk::ImageRegion<3u>, itk::ThreadIdType = unsigned int]’:</div><div><span style="font-size: 12pt;">/home/</span>Desktop/SlicerModules/Cross-Section-Location/Source/CrossSectionLocation.cxx:238:1: instantiated from here</div><div>/home/Support/Slicer-SuperBuild-Release/ITKv4/Modules/Filtering/ImageSources/include/itkPhysicalPointImageSource.hxx:71:7: error: subscripted value is neither array nor pointer</div><div>make[2]: *** [CMakeFiles/CrossSectionLocation.dir/CrossSectionLocation.cxx.o] Error 1</div><div>make[1]: *** [CMakeFiles/CrossSectionLocation.dir/all] Error 2</div><div>make: *** [all] Error 2</div><div><br></div><div>Do you know what that might mean? Any idea?</div><div><br></div><div>Thank you,</div><div>Sarah</div><div><hr id="stopSpelling">From:<span class="Apple-converted-space"> </span><a href="mailto:ahalabasti@hotmail.com">ahalabasti@hotmail.com</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a><br>Date: Fri, 23 May 2014 13:17:13 +0000<br>CC:<span class="Apple-converted-space"> </span><a href="mailto:insight-users@itk.org">insight-users@itk.org</a><br>Subject: Re: [ITK-users] Getting different labels slice by slice<br><br><div dir="ltr">Hi Brad,<div><br></div><div>thank you very much, I really appreciate your help!! It is indeed a great idea what you are proposing, thanks!! Only one question: is the PhysicalPointImageSource used as if it was a normal image (but having the slice number on it)? Sorry for that, but I haven't found any example and I'm quite new with ITK. <br><br>Thank you very much!!</div><div>Sarah<br><div><hr id="ecxstopSpelling">Subject: Re: [ITK-users] Getting different labels slice by slice<br>From:<span class="Apple-converted-space"> </span><a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a><br>Date: Fri, 23 May 2014 07:48:19 -0400<br>CC:<span class="Apple-converted-space"> </span><a href="mailto:insight-users@itk.org">insight-users@itk.org</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:ahalabasti@hotmail.com">ahalabasti@hotmail.com</a><br><br>Hello Sarah,<div><br></div><div>Here is an idea. Create an image where each slice contains the slice number, then add that to you original label image, and do a little binary logic. The goal here would be to give each slice sequentially higher numbers. Then you can runs a statistics image filter in 3D. You can use the a component from the PhysicalPointImageSource[1] as the image with the slice number.</div><div><br></div><div>Good luck,</div><div>Brad</div><div><br></div><div>[1] <a href="http://www.itk.org/Doxygen/html/classitk_1_1PhysicalPointImageSource.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1PhysicalPointImageSource.html</a></div><div><br><div><div>On May 23, 2014, at 6:50 AM, Sarah Basti <<a href="mailto:ahalabasti@hotmail.com">ahalabasti@hotmail.com</a>> wrote:</div><br class="ecxApple-interchange-newline"><blockquote><div class="ecxhmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div dir="ltr">Hello guys,<div><br></div><div>I'm quite new with ITK and I really need your help. I was able to extract/segment 3D objects from an image using the binary threshold image filter. However I'm stuck here, because I need to analyze the mean intensities of these objects in the original image, but I need to to this analysis in 2D, because I need the intensities for each slice. </div><div>As suggested in some other post I tried using the slice by slice filter, converting the binary image into a label map and then into labels. And my idea was to then use the label statistics image filter on the output of the slice by slice filter to extract the mean values. However, it turned out that although the conversion is made slice by slice, many times on adjacent slices the same label is assigned to the same object (I guess that it makes sense!), so when I use the label statistics, is like having 3D labels again, instead of a set of 2D labels. Therefore, I was wondering if there is some option to have different labels for each slice, or there is any other way to evaluate the 2D mean intensity of 3D objects!</div><div><br></div><div>I thank you all in advance!!</div><div><br></div><div>Sarah</div></div>_____________________________________<br>Powered by<span class="ecxApple-converted-space"> </span><a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br><a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a></div></blockquote></div><br></div></div></div></div><br>_____________________________________ Powered by<span class="Apple-converted-space"> </span><a href="http://www.kitware.com/">www.kitware.com</a><span class="Apple-converted-space"> </span>Visit other Kitware open-source projects at<span class="Apple-converted-space"> </span><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><span class="Apple-converted-space"> </span>Kitware offers ITK Training Courses, for more information visit:<a href="http://www.kitware.com/products/protraining.php">http://www.kitware.com/products/protraining.php</a><span class="Apple-converted-space"> </span>Please keep messages on-topic and check the ITK FAQ at:<span class="Apple-converted-space"> </span><a href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><span class="Apple-converted-space"> </span>Follow this link to subscribe/unsubscribe:<span class="Apple-converted-space"> </span><a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a></div></div></div></div></div></blockquote></div><br></div></body></html>