[Insight-users] Generating 4D ImageSource

Luis Ibanez luis.ibanez at kitware.com
Wed May 7 16:23:04 EDT 2008


Hi Mathieu,

I see your point now...

What we should consider is to empower the ImageSource with
the flexibility of the ImageRegionSplitter class

http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageRegionSplitter.html

used in the StreamingImageFilter

http://www.itk.org/Insight/Doxygen/html/classitk_1_1StreamingImageFilter.html


We could create then a larger variety of ImageRegionSplitters
and add to the ImageSource class the method that will allow
to replace the default splitter strategy.

By comparing the code of ImageSource::SplitRequestedRegion()
with the ImageRegionSplitter::GetSplit() method, we can
probably reimplement the functionality in the ImageSource
with a customizable option based on providing a variety of
ImageRegionSplitters.


This could be done with minimal API impact and without
compromising backward compatibility.


For your particular case, we will need a Splitter, for which
the splittingAxis can be set by  the user.


Do you think that this approach may help solve the
problem that you are facing ?


    Thanks


      Luis



-------------------------
Mathieu Malaterre wrote:
> Hi Luis,
> 
> 
>> I would have expected that you would simply use Linear
>> image iterators in order to populate the pixels of your
>> 4D image. This iterator will be a 4D one, and you would
>> be able to walk across the 4th dimension (time in this
>> case) with the inner loop of the iterator.
> 
> 
> Correct, but you are only walking over [t1, t2] where t1,t2 are
> defined by the SplitRequestRegion.
> Since my function f(x,y,z) generate the whole signal over t, I need to
> call it N times (where N is basically the number or thread running)
> and only copy the [t1, t2] interval I am intersted in.
> 
> The function is actually so costly that a single threaded with a
> single call to the function is actually faster than the threaded
> version.
> 
> I have not thought of creating a 3D image made of N components, I might try it.
> 
> Thanks anyway,
> -Mathieu
> 
> On Wed, May 7, 2008 at 7:50 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> 
>> Hi Mathieu,
>>
>> You are right, the ImageSource::SplitRequestedRegion() API
>> doesn't have an option for allowing you to select the axis
>> across which to split the dataset.
>>
>> I'm a bit confused as to why do you need to customize this
>> at all...
>>
>>
>> I would have expected that you would simply use Linear
>> image iterators in order to populate the pixels of your
>> 4D image. This iterator will be a 4D one, and you would
>> be able to walk across the 4th dimension (time in this
>> case) with the inner loop of the iterator.
>>
>>
>> Another option that you may want to consider is to represent
>> your image as a 3D image with N components per pixel, where
>> the N components correspond to the N instances of time in
>> your signal(t).
>>
>>
>> The choice of one representation over the other would mostly
>> depend on what kind of algorithms you anticipate that you
>> will be running in this data.
>>
>>
>>
>>   Regards,
>>
>>
>>      Luis
>>
>>
>> -------------------------
>>
>>
>> Mathieu Malaterre wrote:
>>
>>
>>>Hi there,
>>>
>>> I am working on a very simple task: generate a 4D dataset in ITK. I
>>>have a function f(x,y,z) which return a discretized signal(t)
>>>function. So I want to loop over (x,y,z) and set all value on the last
>>>dimension (t).
>>> However default implementation of ImageSource::SplitRequestedRegion
>>>is splitting extents on the last dimension.
>>>
>>> From the documentation, I do not understand how I can specify which
>>>axis is to be split for the threaded execution.
>>>
>>>Thanks,
>>>
>>
> 
> 
> 


More information about the Insight-users mailing list