<font size="2"><font face="verdana,sans-serif">I solved it by transforming it into a function. If someone runs into a similar issue, the function is below:<br></font></font><div><font class="Apple-style-span" face="verdana, sans-serif"><br>
</font></div><div><span class="Apple-style-span" style="font-family: 'courier new', monospace; ">//define type of "pointer to function" (does the actual combination)</span></div><div><div><font class="Apple-style-span" face="'courier new', monospace">typedef float (*CombineFunction)(std::vector<float>); </font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">InternalImageType::Pointer combineClassifiers</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> (std::vector<InternalImageType::Pointer> classifiers,</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> CombineFunction combinationMethod)</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">{</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> InternalImageType::Pointer output=InternalImageType::New();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> output->CopyInformation(classifiers[0]);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> output->SetRegions(output->GetLargestPossibleRegion());</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> output->Allocate();</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> itk::ImageRegionIterator<InternalImageType> out(output, output->GetLargestPossibleRegion());</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> unsigned i=0,nIn=classifiers.size();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> std::vector<float> probabilities(nIn); //individual classifier results</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> InternalImageType::PointType p;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> InternalImageType::IndexType ind0, indN;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> while(!out.IsAtEnd())</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> {</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> ind0=out.GetIndex();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> probabilities[0]=classifiers[0]->GetPixel(ind0);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> output->TransformIndexToPhysicalPoint(ind0, p);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> for (i=1; i<nIn; i++) //collect from input images into std::vector</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> { </font></div><div><font class="Apple-style-span" face="'courier new', monospace"> classifiers[i]->TransformPhysicalPointToIndex(p, indN);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> probabilities[i]=classifiers[i]->GetPixel(indN);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> }</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> </font></div><div><font class="Apple-style-span" face="'courier new', monospace"> out.Set(combinationMethod(probabilities)); //calculate output using chosen method</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> ++out;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> }</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> return output;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">}</font></div></div><div><font class="Apple-style-span" face="verdana, sans-serif"><br></font><div class="gmail_quote">2011/8/9 Dženan Zukić <span dir="ltr"><<a href="mailto:dzenanz@gmail.com">dzenanz@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><font face="verdana, sans-serif">Hi guys,</font><div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">I am trying to create a filter with n+m inputs and 1 output. n inputs have full size (the whole image), while the remaining m inputs are only a certain sub-region of that image (schematic attached).</font></div>
<div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">I have written all the code, and it works well for the case of 4 same-sized inputs. But when 3 cropped inputs are added, I hit and exception in</font></div>
<div><span style="font-family:verdana, sans-serif">d:\sdk\itk4\modules\core\common\include\itkImageToImageFilter.hxx, line 253</span></div><div><font face="verdana, sans-serif"><div>
Inputs do not occupy the same physical space!</div><div>InputImage Origin: [26.107, -141.741, 231.561], InputImage4 Origin: [26.4835, -27.7276, 75.3783]</div><div><br></div><div>The main reason I wrote this logic as a filter is that it is easily parallelizable and I wanted to take advantage of the filter multithreading infrastructure.</div>
<div><br></div><div>Of course, I want to produce the output the same size (and position) as the smaller images, sampling larger images by voxel position, not index.</div><div><br></div><div>Is there some workaround for this limitation or should I just abandon multithreading and write normal sequential function?</div>
</font></div><div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">Regards,</font></div><div><font face="verdana, sans-serif">Dženan</font></div>
</blockquote></div><br></div>