<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>There is an article I wrote for the Kitware Source that is useful if you want to do IO Streaming:</div><div><a href="http://www.kitware.com/products/archive/kitware_quarterly0409.pdf">http://www.kitware.com/products/archive/kitware_quarterly0409.pdf</a></div><div><br></div><div>And it's related example in:</div><div>Insight/Examples/IO/VisibleHumanStreamReadWrite.cxx</div><div><br></div><div><br></div><div>Currently metaIO is the only format to fully support streaming IO. So you will need to use an mha &nbsp;(or mhd) file extension.</div><div><br></div><div>To enable streaming IO, you simple need to have a file format which supports it and the call</div><div><br></div><div>ImageFileWriter::SetNumerOfStreamDivisions( unsigned int )</div><div><br></div><div>For this parameter the number of z-slices frequently works well, which can be obtained after</div><div><br></div><div>ImageFileReader::GenerateOutputInformation( )</div><div><br></div><div>has been called. Then accessing the LargestPossibleRegion.</div><div><br></div><div><br></div><div>Hope this helps,</div><div>Brad</div><div><br><div><div>On Nov 5, 2009, at 4:24 AM, Dan Mueller wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi Darren,<br><br>Reading your email again, perhaps I jumped the gun a bit by suggesting<br>the sparse image. The sparse image is designed for images which have a<br>few relevant pixels, but the rest background (ie. you don't set all<br>the pixels, just a few here and there).<br><br>If you need to process an entire image, then I think ITK's read/write<br>streaming feature will better suit your needs (assuming you can break<br>your processing into chunks).<br> &nbsp;&nbsp;&nbsp;<a href="http://www.cmake.org/pipermail/insight-users/2002-May/000472.html">http://www.cmake.org/pipermail/insight-users/2002-May/000472.html</a><br> &nbsp;&nbsp;&nbsp;<a href="http://www.itk.org/Doxygen/html/StreamingPage.html">http://www.itk.org/Doxygen/html/StreamingPage.html</a><br> &nbsp;&nbsp;&nbsp;<a href="http://www.itk.org/Doxygen/html/group__StreamingGroup.html">http://www.itk.org/Doxygen/html/group__StreamingGroup.html</a><br> &nbsp;&nbsp;&nbsp;<a href="http://www.insight-journal.org/browse/publication/305">http://www.insight-journal.org/browse/publication/305</a><br><br>Please provide an exact overview of what you are trying to achieve, so<br>we can help determine the best approach.<br><br>Cheers, Dan<br><br>2009/11/5 Darren Weber &lt;<a href="mailto:darren.weber.lists@gmail.com">darren.weber.lists@gmail.com</a>&gt;:<br><blockquote type="cite"><br></blockquote><blockquote type="cite">Hi Dan,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The proposal is very interesting.&nbsp; Having read the PDF, I'll take a look at<br></blockquote><blockquote type="cite">the code.&nbsp; I may be able to offer a review (time permitting).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Do you have any recent examples of using either the SliceContiguous or the<br></blockquote><blockquote type="cite">Sparse images to compose a 3D volume from a series of 2D image files?&nbsp; Do<br></blockquote><blockquote type="cite">you somehow<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">a) Allocate the custom image memory (if known size &amp; pixtype)<br></blockquote><blockquote type="cite">b) Create an IO object to read data from an image file<br></blockquote><blockquote type="cite">c) manually iterate over the IO object data with Get/Set accessors to put<br></blockquote><blockquote type="cite">data into custom image memory<br></blockquote><blockquote type="cite">d) Filter, etc. (if possible)<br></blockquote><blockquote type="cite">e) Write out image data to disk (somehow)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I can take the performance hit for the sparse image with Setting values.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Should I be looking into streaming data models?&nbsp; Essentially all I need to<br></blockquote><blockquote type="cite">do is stream a set of 2D input data straight out to a 3D output data file.<br></blockquote><blockquote type="cite">I'm currently using a series reader (with a regex to define the image<br></blockquote><blockquote type="cite">series) and piping it straight to a writer (with vtkIO for the writer).&nbsp; If<br></blockquote><blockquote type="cite">a streaming model is available for this data transfer, it might avoid the<br></blockquote><blockquote type="cite">segfaults due to allocation limits (I have plenty of disk space, just not<br></blockquote><blockquote type="cite">enough RAM).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thanks!<br></blockquote><blockquote type="cite">Darren<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On Wed, Nov 4, 2009 at 1:54 PM, Dan Mueller &lt;<a href="mailto:dan.muel@gmail.com">dan.muel@gmail.com</a>&gt; wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Hi Darren,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">You might want to investigate the following Insight Journal submission:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&nbsp; &nbsp;<a href="http://www.insight-journal.org/browse/publication/646">http://www.insight-journal.org/browse/publication/646</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&lt;shameless plug&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Make sure you leave a review!<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&lt;/shameless plug&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Cheers, Dan<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">2009/11/4 Darren Weber &lt;<a href="mailto:darren.weber.lists@gmail.com">darren.weber.lists@gmail.com</a>&gt;:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I'm working with a very large dataset (1000's of 2D images, size &gt;<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">1024x1024<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">pixels, ushort RGB pixels).&nbsp; A large portion of these images is<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">background.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">A few routines, like saving all the 2D images into a 3D volume, fail<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">with<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">segfaults due to malloc errors (on OSX 10.5.8 with 24Gb RAM; using ITK<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">3.16.0).<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Is there an image format that provides 'sparse' images?&nbsp; This implies<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">there<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">are no data values for some of the image pixels (is this the same thing<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">as<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">transparent background?).<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">What is an optimal image format for working with this data?<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Thanks in advance (TIA),<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Darren<br></blockquote></blockquote></blockquote>_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.html<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></div></blockquote></div><br><div>
<span class="Apple-style-span" style="font-size: 12px; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">========================================================</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Bradley Lowekamp<span class="Apple-converted-space">&nbsp;</span><span class="Apple-converted-space">&nbsp;</span></font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font class="Apple-style-span" face="Arial"><span class="Apple-style-span" style="font-family: Arial; "><span class="Apple-style-span" style="font-family: Arial; ">Lockheed Martin&nbsp;</span></span></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Contractor for</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Office of High Performance Computing and Communications</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">National Library of Medicine<span class="Apple-converted-space">&nbsp;</span></font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a></font></p><br class="Apple-interchange-newline"></span>
</div>
<br></div></body></html>