[Insight-developers] Advice on filter writing -- 2 arrays of images as inputs?

Luis Ibanez luis.ibanez at kitware.com
Fri Oct 9 11:58:57 EDT 2009


Kent,

In the case that you are considering,
Are we talking about arrays of tens, hundreds of images ?

or a rather a handful (like 4~6 images).

If the case involves large numbers of images, then I would
be inclined to create an ImageArray class that derives from
DataObject.

This class will have to make sure to implement the Modified()
method in such a way that if any of its element image is
Modified, then the array as a whole will be marked as modified.

The other challenging aspect will be to define how is that
region computations should be performed.

Are the images expected to be all of the same:

  * Pixel type ?
  * Size in pixels  ?
  * Spacing ?
  * Origin ?
  * Orientation ?

Thing may become challenging if the filter allows for a
collection of images that do not share the same sampling
grid.


BTW, we may have seen similar cases in the filter that
composes DWI images:

You may want to take a look at:

./Code/BasicFilters/itkDiffusionTensor3DReconstructionImageFilter.h



    My 2 cents,


        Luis



---------------------------------------------------------------------------------------
On Wed, Oct 7, 2009 at 10:55 AM, Dan Mueller <dan.muel at gmail.com> wrote:
> Hi Kent,
>
> You can simply fake a 2-D array using the 1-D SetNthInput. For
> example, if both arrays are of length 5, array A takes indices 0-4,
> array B takes indices 5-9.
>
> I used a similar pattern to support multilevel/multiband
> inputs/outputs for wavelet-based quadrature mirror filters (QMF). It's
> not a perfect implementation (I was still a noob when I wrote it), but
> you might get some ideas:
>    http://www.insight-journal.org/browse/publication/103
>
> Particularly take a look at gift::MultilevelMultibandImageFilter.
>
> Hope this helps.
>
> Cheers, Dan
>
> 2009/10/7 Bradley Lowekamp <blowekamp at mail.nih.gov>:
>> Hello Kent,
>> That sounds like an interesting design problem. My first thought was to make
>> the custom image array a data object, but that still would not let you use
>> the ImageToImage filter and would require a rewriting that class.
>> What about considering the input two vector images? If you can restrict the
>> input to scalars, then you might be able to internally use two
>> ImageToVectorImageFilters?
>> Just a thought hope it helps,
>> Brad
>> On Oct 6, 2009, at 6:09 PM, kent williams wrote:
>>
>> I have been assigned the task of converting one of those faux-ITK filters
>> that people write -- you know, where they have SetInput(s), Update() and
>> GetOutput(s) but it's not actually a pipeline-compatible filter -- into an
>> actual ITK filter.
>>
>> What's blowing my mind about it is that as it stands, it takes as inputs two
>> arrays of images. Not an itk::Array or itk::Vector, but a homegrown array
>> class.
>>
>> My question is this: What is the most ITK-esque way to handle two sets of
>> multiple image inputs?  SetNthInput seems fine for a class with only one
>> array of homogenous inputs, but I don't know what to do with a second array.
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
>> ========================================================
>>
>> Bradley Lowekamp
>>
>> Lockheed Martin Contractor for
>>
>> Office of High Performance Computing and Communications
>>
>> National Library of Medicine
>>
>> blowekamp at mail.nih.gov
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list