<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>The wiki examples are a wonderful resource put together by the community! With some very dedicated individuals.</div><div><br></div><div>To me is sounds like you are dealing more with 3D image of vector as opposed to 4D images. I would look into using a VectorImage for image input, this image class allows for variable number of components. For the output I'd look into an Image of FixedArray, Vector etc..</div><div><br></div><div>What version of ITK are you using? If you really do need true 4D images, &nbsp;then some important changes have happened in ITK. Just in the past month I have modularized how image region splitting is performed in many areas of ITK include threading. Basically, there is a new ImageRegionSplitterBase[1] class that can be plugged into filter to changes how images a split for multi-threading. &nbsp;The ImageRegionSplitterSlowDimension contains the code to split images that was in the ImageSource. There is now a ImageSource::GetImageRegionSplitter[3] method which returns the object used to perform the splitting for multi-threading. This can be overloaded to return the appropriate splitter object for the algorithm implemented in a filter. An example of this is in the RecursiveSeparableImageFilter[4]. It uses the ImageRegionSpliterDirection class to split is a specified direction. For yourself you could specify dimension direction 2. From there is should be easy to define the input region from the outputRegionForThread to accomplish what you wish.</div><div><br></div><div>Hope this bit of a tangent helps,</div><div>Brad</div><div><br></div><div>[1]&nbsp;<a href="http://www.itk.org/Doxygen/html/classitk_1_1ImageRegionSplitterBase.html">http://www.itk.org/Doxygen/html/classitk_1_1ImageRegionSplitterBase.html</a></div><div>[2]&nbsp;<a href="http://www.itk.org/Doxygen/html/classitk_1_1ImageRegionSplitterSlowDimension.html">http://www.itk.org/Doxygen/html/classitk_1_1ImageRegionSplitterSlowDimension.html</a></div><div>[3]&nbsp;<a href="http://www.itk.org/Doxygen/html/classitk_1_1ImageSource.html#ab009a02af33d02e6d5376cb1fb0efe05">http://www.itk.org/Doxygen/html/classitk_1_1ImageSource.html#ab009a02af33d02e6d5376cb1fb0efe05</a></div><div>[4] <a href="https://github.com/Kitware/ITK/blob/master/Modules/Filtering/ImageFilterBase/include/itkRecursiveSeparableImageFilter.hxx#L190">https://github.com/Kitware/ITK/blob/master/Modules/Filtering/ImageFilterBase/include/itkRecursiveSeparableImageFilter.hxx#L190</a></div><div><br><div><div>On May 2, 2013, at 2:32 AM, Soren Christensen &lt;<a href="mailto:sorench@gmail.com">sorench@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><div dir="ltr">Hi,<div>&nbsp;I am trying to create a filter using ImageToImageFilter that I would like to be multi-threaded.</div><div>However, I have some trouble figuring out how to get the dimensions right.</div><div><br></div>


<div>The input is 4D and I want to create an output that is also 4D, but the fourth dimension of the output will always be of constant length in the output, say L=4. (So Dim4 is a vector dim and regardless of the input length the outputs 4th dimension will have length 4).</div>

<div style="">In&nbsp;<span style="font-style: italic; ">ThreadedGenerateData(), </span><span style="">I would like to just iterate spatial positions (the first 3 dimensions) so for example partition&nbsp;</span><span style="">the&nbsp;</span><span style="">outputRegionForThread</span><span style="">&nbsp;partitioned along the 3rd dimension (although along 1 or 2nd dim would work too).</span></div>

<div style=""><span style="">So essentially I want to iterate over all spatial locations (dimensions 1-3), and for each spatial location grab the vector along the 4th dimension. For each location, the result (vector of length 3) is written into the 4D output.</span></div>

<div style=""><span style=""><br></span></div><div style=""><span style="">It seems to me that once I define the output dimensions in&nbsp;</span><span style="font-style: italic; ">GenerateOutputInformation() </span><span style="">(4D)</span><span style="">, then&nbsp;</span><span style="font-style: italic; ">ThreadedGenerateData() </span><span style="">will partition THIS 4D region whereas I am looking to iterate just the first 3 dimensions of the output.</span></div>

<div style=""><span style="">How can I achieve this?&nbsp;</span></div><div style=""><span style="">Should I be looking at using vector images for this? &nbsp;Or multiple outputs?</span></div><div style=""><span style=""><br>

</span></div><div style=""><span style="">Thanks</span></div><div style=""><font>Soren</font></div><div style=""><span style=""><br></span></div><div style=""><span style=""><br>

</span></div><div style=""><span style="">Btw:</span></div><div style=""><span style="">Thanks to whoever put all the examples on Wiki &nbsp;- they are fantastic.</span></div><div style=""><span style=""><br>

</span></div><div style=""><span style=""><br></span></div><div style=""><span style="">&nbsp;&nbsp;</span></div>




</div>
_____________________________________<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.php<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></blockquote></div><br></div></body></html>