<div dir="ltr">Many thanks!<div style>I&#39;ll give vector images a shot - it sounds like the obvious solution.</div><div style>Great to know abut the new regionsplitting functionality too, so thanks for the detailed answer. I am using 4.3 btw.</div>

<div style><br></div><div style><br></div><div style>Soren</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 2, 2013 at 6:04 AM, Bradley Lowekamp <span dir="ltr">&lt;<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">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&#39;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,  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.  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] <a href="http://www.itk.org/Doxygen/html/classitk_1_1ImageRegionSplitterBase.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1ImageRegionSplitterBase.html</a></div>

<div>[2] <a href="http://www.itk.org/Doxygen/html/classitk_1_1ImageRegionSplitterSlowDimension.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1ImageRegionSplitterSlowDimension.html</a></div><div>[3] <a href="http://www.itk.org/Doxygen/html/classitk_1_1ImageSource.html#ab009a02af33d02e6d5376cb1fb0efe05" target="_blank">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" target="_blank">https://github.com/Kitware/ITK/blob/master/Modules/Filtering/ImageFilterBase/include/itkRecursiveSeparableImageFilter.hxx#L190</a></div>

<div><br><div><div><div class="h5"><div>On May 2, 2013, at 2:32 AM, Soren Christensen &lt;<a href="mailto:sorench@gmail.com" target="_blank">sorench@gmail.com</a>&gt; wrote:</div><br></div></div><blockquote type="cite"><div>

<div class="h5"><div dir="ltr">Hi,<div> 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>In <span style="font-style:italic">ThreadedGenerateData(), </span><span>I would like to just iterate spatial positions (the first 3 dimensions) so for example partition </span><span>the </span><span>outputRegionForThread</span><span> partitioned along the 3rd dimension (although along 1 or 2nd dim would work too).</span></div>



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



<div><span>How can I achieve this? </span></div><div><span>Should I be looking at using vector images for this?  Or multiple outputs?</span></div><div><span><br>

</span></div><div><span>Thanks</span></div><div><font>Soren</font></div><div><span><br></span></div><div><span><br>

</span></div><div><span>Btw:</span></div><div><span>Thanks to whoever put all the examples on Wiki  - they are fantastic.</span></div><div><span><br>

</span></div><div><span><br></span></div><div><span>  </span></div>




</div></div></div>
_____________________________________<br>Powered by <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><br>

</blockquote></div><br></div></div></blockquote></div><br></div>