[Insight-developers] Modifying MaskImageFilter to work on VectorImage
Gaëtan Lehmann
gaetan.lehmann at jouy.inra.fr
Mon Apr 11 05:10:41 EDT 2011
Hi Cory,
I think this code would fail if the mask filter is run a second time
with a vector image with a different number of components.
There should be a check for the number of components in
BeforeThreadedGenerateData().
The initialization of the default value of OutsideValue is quite
problematic, as it can be done only when the number of components is
known.
A better option would be to have a way to say "I want to use the
default value" - in that case the value can be generated in
BeforeThreadedGenerateData() and would fit the vector the filter is
currently working on - or "I want to use that value" and then it is
the responsibility of the user to provide the right number of
components.
One way to implement that is to use a 3rd input for the filter which
would be of type
SimpleDataObjectDecorator< PixelType >
and to not provide a default value by default - just keep the 3rd
input as NULL. If there is no 3rd input, then the default value of
OutsideValue can be generated in BeforeThreadedGenerateData(). If
there is a 3rd input, then just use the value provided.
An additional benefit of that approach: the OutsideValue can be
provided through the pipeline, which is not the case currently.
Does that seem reasonable?
Gaëtan
Le 11 avr. 11 à 07:30, Cory Quammen a écrit :
> David and Luis,
>
> I have posted a potential solution on github.
>
> https://github.com/cquammen/ITK/commit/a92bcc79f267d79f48abb7358881c4b2323ae01d
>
> I will post it to gerrit if you don't see any showstoppers.
>
> Thanks,
> Cory
>
> On Sun, Apr 10, 2011 at 5:50 PM, Luis Ibanez
> <luis.ibanez at kitware.com> wrote:
>> Hi David,
>>
>> We have been discussing this problem with Julien Malik from the
>> Orfeo Toolbox team.
>>
>> In summary, there is a function in the NumericTraits that is intended
>> to deal with management of size in containers of variable size
>> such as the VariableLengthVector and the std::vector.
>>
>> Regarding your questions, please see below.
>>
>> On Thu, Apr 7, 2011 at 7:50 PM, David Doria <daviddoria at gmail.com>
>> wrote:
>>> We have been having some discussion on the best way to allow
>>> MaskImageFilter
>>> to work on VectorImage (with pixels of type
>>> VariableLengthVector) . The
>>> problem is that the length of a VariableLengthVector is not
>>> defined at
>>> compile time. This means that in the MaskInput functor, the
>>> member m_OutsideValue cannot be initialized.
>>>
>>> Brad has identified two problems,
>>>
>>> 1) How do we initialized the member variable in the functor?
>>>
>>
>> We usually add "Set" methods to the functor,
>> the add "Set" methods to the Filter itself,
>> and they simply call the "Set" methods of the functor.
>>
>>> This seems to be the main issue I'm not sure how to address.
>>>
>>> 2) When do we detect the size of the vector image, and use
>>> reasonable
>>> defaults?
>>>
>>
>>
>> At run time,
>> by asking them for their "GetNumberOfComponents()
>> from the vector image.
>>
>> Reasonable default (otherwise) is "1".
>>
>>> We think this could be done in BeforeThreadedGenerateData.
>>>
>>
>> Yes, that's a good place.
>>
>> The GenerateInputInformation() or
>> GenerateOutputInformation() may
>> be good places as well.
>>
>>
>>> The complete conversation is here:
>>>
>>> http://review.source.kitware.com/#change,1338
>>> Any thoughts are welcome!
>>> Thanks,
>>>
>>> David
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://kitware.com/products/protraining.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
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.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
>>
>
>
>
> --
> Cory Quammen
> Computer Integrated Systems for Microscopy and Manipulation (CISMM)
> Department of Computer Science
> University of North Carolina at Chapel Hill
> http://www.cs.unc.edu/~cquammen
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.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
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr http://www.itk.org
http://www.mandriva.org http://www.bepo.fr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110411/e049e771/attachment.pgp>
More information about the Insight-developers
mailing list