[Insight-developers] Strategy pattern for SimpleITK

Blezek, Daniel J. Blezek.Daniel at mayo.edu
Sat Nov 6 08:45:49 EDT 2010


Hi Dan. I will have a look at your code and make sure we discuss. 

Cheers,
-dan

--
Daniel Blezek
blezek.daniel at mayo.edu
blezek at gmail.com
Sent from my TI 99/4A

On Nov 6, 2010, at 6:25 AM, "Dan Mueller" <dan.muel at gmail.com> wrote:

> Hi all,
> 
> I cannot attend the ITKv4 meeting in Iowa.
> 
> Before the meeting I wanted to put together an example of how the
> strategy pattern
>     http://en.wikipedia.org/wiki/Strategy_pattern
> could be used to simplify ITK.
> 
> Unfortunately I have not had time to put the finishing touches on the
> example, but I include it here nonetheless. I hope it can be
> discussed.
>     https://github.com/danmuel/SimpleITK/commit/275570295619aa3c812bcf3c7973eff84c374bc7
> 
> In my example, I created "itkSimpleUnaryImageFilter" which employs the
> "itkStrategyFactory" to bring together 20+ filters into a single
> filter. If I had the time, it would have been used as follows (using
> C# wrapping):
>     Unary unary = new Unary();
>     unary.setStrategy(UnaryStrategy.UnaryStrategyAbs);
>     //unary.setStrategy(UnaryStrategy.UnaryStrategyExp); // Cos,
> Log10, Log, Not, Sin, Tan...
>     image = unary.execute(image);
> 
> The strategy pattern could be applied to a wide range of
> filters/object, including the registration framework Eg. (syntax
> dreamed up)
>     Metric metric = new Metric(MetricStrategy.NormalizedCorrelation);
>     metric.setSomeParameter(someValue1);
>     Interpolator interpolator = new Interpolator(InterpolatorStrategy.BSpline);
>     Transform transform = new Transform(TransformStrategy.Affine);
>     Optimizer optimizer = new Optimizer(OptimizerStrategy.GradientDescent);
>     optimizer.setSomeParameter(someValue2);
>     RegistrationMethod registration = new RegistrationMethod();
>     registration.setMetric(metric);
>     registration.setInterpolator(interpolator);
>     registration.setTransform(transform);
>     registration.setOptimizer(optimizer);
>     registration.setFixedImage(fixed);
>     registration.setMovingImage(moving);
>     registration.execute();
> 
> Here is an initial list of possible objects which could employ the pattern:
> UnaryPixelMath: Abs, Acos, Asin, Atan, Cos, Exp, Log10, Log, Not,
> Sigmoid, Sin, Sqrt, Square, ...
> BinaryPixelMath: Add, Subtract, Multiple, Divide, And, Or, Xor,
> Maximum, Minimum, Mask, SquaredDifferance, CheckerBoard, ...
> InterpolateImageFunction: Linear, BSpline, CosineWindowedSinc,
> HammingWindowedSinc, LanczosWindowedSinc, WelchWindowedSinc
> DistanceMap: Danielsson, SignedDanielsson, Chamfer, ApproximateSigned,
> SignedMaurer
> Morphology: BinaryDilate, BinaryErode, BinaryOpen, BinaryClose,
> BinaryShapeOpen, GreyscaleOpen, GreyscaleClose, GreyscaleDilate,
> GreyscaleErode, AreaOpen, AnchorOpen, AnchorClose,
> VanHerkGilWermanOpen, VanHerkGilWermanClose, ...
> ImageToImageMetric: KappaStatistic, MatchCardinality,
> MattesMutualInformation, MeanReciprocalSquareDifference, MeanSquares,
> NormalizedCorrelation, NormalizedMutualInformationHistogram
> 
> Obviously there are still some issues to sort out, but I think the
> strategy pattern can really help make ITK "simple".
> 
> What do you think?
> 
> Cheers, Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20101106/08c2a1ca/attachment.htm>


More information about the Insight-developers mailing list