[Insight-developers] add template parameters to optimizer base class

Luis Ibanez luis.ibanez at kitware.com
Sun May 1 12:20:35 EDT 2011


Hi Michael,

We can't change the API of classes in VXL.

Unless of course, we bring the VXL developers
to adopt that change upstream.

You may have to explore an alternative
design that doesn't require modifying VXL.


      Luis


---------------------------------------

On Thu, Apr 28, 2011 at 1:58 PM, M Stauffer (V) <mstauff at verizon.net> wrote:

> Hi again,
>
> Another issue:
>
> In order to completely template the optimizers, I'd have to also
> template a couple vnl classes over ValueType:   vnl_cost_function &
> vnl_least_squares_function
>
> It looks like this would be straight-forward, but thought it prudent to
> check since modifying vnl classes is maybe a different beast in terms of
> maintainence.
>
> These classes use vnl classes that are already templated over a value
> type, so it shouldn't require any further templating.
>
> vnl_cost_function dervies from vnl_unary_function, and I see a file
> "vnl/Templates/vnl_unary_function+double.vnl_vector+double--.cxx" that
> simply defines an instantiation macro. Do I manually create a matching
> file for type float, or is that done automagically somehow?
>
> If convert these classes to templated classes, do I need to add similar
> files for them, as above, in vnl/Templates dir?
>
> These classes are included in about 10 other vnl classes, which look
> like they could simply be modified to use these classes with the default
> template parameter for value type, or use type double when the code
> looks to use double explicitly.
>
> Shall I proceed?
>
> -M
>
> >-----Original Message-----
> >From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
> >Sent: Tuesday, April 26, 2011 4:41 PM
> >To: M Stauffer (V)
> >Cc: Johnson, Hans J; brian avants; Gaëtan Lehmann; ITK;
> >Williams, Norman K
> >Subject: Re: [Insight-developers] add template parameters to
> >optimizer base class
> >
> >Michael,
> >
> >That sounds like a good plan.
> >
> >    Luis
> >
> >
> >--------------------
> >On Tue, Apr 26, 2011 at 12:27 PM, M Stauffer (V)
> ><mstauff at verizon.net> wrote:
> >> OK, thanks. I probably got confused with the discussion about
> >> overhauling the transform IO approach, and possibly all IO, using
> >> serialization.
> >>
> >> Concerning templating the various Transform IO classes over a
> >> ValueType/ScalarType - should I go ahead and do this (with
> >'double' as
> >> default), or are there other considerations I may be missing?
> >>
> >> -M
> >>
> >>>-----Original Message-----
> >>>From: Johnson, Hans J [mailto:hans-johnson at uiowa.edu]
> >>>Sent: Friday, April 22, 2011 6:46 PM
> >>>
> >>>Kent (AKA Norman) is not overhauling the TransformIO, but he
> >>>is adding one
> >>>more IO file format support to the existing framework.
> >>>
> >>>Hans
> >>>
> >>>
> >>>On 4/22/11 4:07 PM, "M Stauffer (V)" <mstauff at verizon.net> wrote:
> >>>
> >>>>Hi,
> >>>>
> >>>>Templating the optimizers over a parameter ValueType requires that
> >>>>transforms have parameters of the same type, which requires
> >templating
> >>>>TransformBase over parameter value type as well. This is easy
> >>>enough to
> >>>>propgate, since we can use the TScalarType, over which Transform and
> >>>>derived classes are templated, to pass to TransformBase for the
> >>>>parameter ValueType template parameter.
> >>>>
> >>>>However, this effects TransformIO and related classes, which use
> >>>>TransformBase pointers to hold their transform lists. For now
> >>>I'll just
> >>>>have these template TransformBase over double, w/out
> >templating the IO
> >>>>classes themselves. And since Norman is overhauling the TransformIO
> >>>>method, this should be taken care of there.
> >>>>
> >>>>Does this sound reasonable?
> >>>>
> >>>>Cheers,
> >>>>Michael
> >>>>
> >>>>>-----Original Message-----
> >>>>>From: insight-developers-bounces at itk.org
> >>>>>[mailto:insight-developers-bounces at itk.org] On Behalf Of
> >>>>>Johnson, Hans J
> >>>>>Sent: Wednesday, March 30, 2011 5:22 PM
> >>>>>To: Luis Ibanez; brian avants; Gaëtan Lehmann
> >>>>>Cc: ITK
> >>>>>Subject: Re: [Insight-developers] add template parameters to
> >>>>>optimizer base class
> >>>>>
> >>>>>Luis,
> >>>>>
> >>>>>I would vote for this and propose that the wrapping only use
> >>>the double
> >>>>>precision version for backwards compatibility.
> >>>>>
> >>>>>Hans
> >>>>>
> >>>>>--
> >>>>>Hans J. Johnson, Ph.D.
> >>>>>hans-johnson at uiowa.edu
> >>>>>Assistant Professor of Psychiatry
> >>>>>University of Iowa Carver College of Medicine
> >>>>>W278 GH, 200 Hawkins Drive
> >>>>>
> >>>>>Iowa City, Iowa 52242
> >>>>>Phone:  319-353-8587
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>-----Original Message-----
> >>>>>From: Luis Ibanez <luis.ibanez at kitware.com>
> >>>>>Date: Wed, 30 Mar 2011 17:17:33 -0400
> >>>>>To: brian avants <stnava at gmail.com>, Gaëtan Lehmann
> >>>>><gaetan.lehmann at jouy.inra.fr>
> >>>>>Cc: ITK <insight-developers at itk.org>
> >>>>>Subject: Re: [Insight-developers] add template parameters to
> >>>optimizer
> >>>>>base class
> >>>>>
> >>>>>Hi Brian,
> >>>>>
> >>>>>We should check with Gaetan on the implications
> >>>>>that this new template parameter may have in the Wrapping...
> >>>>>
> >>>>>
> >>>>>       Luis
> >>>>>
> >>>>>
> >>>>>---------------------------------------------------------------
> >>>>>------------
> >>>>>-------------
> >>>>>On Tue, Mar 29, 2011 at 5:19 PM, brian avants
> >>><stnava at gmail.com> wrote:
> >>>>>> hi everyone
> >>>>>>
> >>>>>> itkCostFunction defines the following:
> >>>>>>
> >>>>>> class ITK_EXPORT CostFunction:public Object
> >>>>>> {
> >>>>>> public:
> >>>>>>
> >>>>>> < snip >
> >>>>>>
> >>>>>>  /**  ParametersType typedef.
> >>>>>>   *  It defines a position in the optimization search space. */
> >>>>>>  typedef double                       ParametersValueType;
> >>>>>>  typedef Array< ParametersValueType > ParametersType;
> >>>>>>
> >>>>>> ....
> >>>>>>
> >>>>>> what we'd like to do is define ParametersValueType via a template
> >>>>>>parameter
> >>>>>> such that we can use float type.
> >>>>>>
> >>>>>> the motivation is to allow us to have
> >>>Derivatives/Parameters that are
> >>>>>> float deformation fields or float BSpline parameter
> >images that are
> >>>>>> then memory mapped to Parameter/DerivativeType arrays.
> >>>>>>
> >>>>>> does anyone have any objection?   we'd have to make changes
> >>>>>to all the
> >>>>>> derived classes but these changes should be backward compatible
> >>>>>> because the default template parameter for
> >>>ParametersValueType would
> >>>>>> be double ( as it currently is ).
> >>>>>>
> >>>>>> brian
> >>>>>> _______________________________________________
> >>>>>> 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
> >>>>>
> >>>>>
> >>>>>
> >>>>>________________________________
> >>>>>Notice: This UI Health Care e-mail (including attachments) is
> >>>>>covered by the Electronic Communications Privacy Act, 18
> >>>>>U.S.C. 2510-2521, is confidential and may be legally
> >>>>>privileged.  If you are not the intended recipient, you are
> >>>>>hereby notified that any retention, dissemination,
> >>>>>distribution, or copying of this communication is strictly
> >>>>>prohibited.  Please reply to the sender that you have received
> >>>>>the message in error, then delete it.  Thank you.
> >>>>>________________________________
> >>>>>_______________________________________________
> >>>>>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
> >>>>
> >>>
> >>>
> >>>
> >>>________________________________
> >>>Notice: This UI Health Care e-mail (including attachments) is
> >>>covered by the Electronic Communications Privacy Act, 18
> >>>U.S.C. 2510-2521, is confidential and may be legally
> >>>privileged.  If you are not the intended recipient, you are
> >>>hereby notified that any retention, dissemination,
> >>>distribution, or copying of this communication is strictly
> >>>prohibited.  Please reply to the sender that you have received
> >>>the message in error, then delete it.  Thank you.
> >>>________________________________
> >>
> >>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110501/1d5d7574/attachment.htm>


More information about the Insight-developers mailing list