[Insight-developers] GaussianImageSource

Damion Shelton dmshelto@andrew.cmu.edu
Wed, 20 Feb 2002 16:23:14 -0500


Hi...

> However your class mix two style for passing parameters:
>
> 1) SetVectorMacro(); (using a *type, and an int)
> 2) SetMacro()   with an itk::Array
>
> Spacing,Origin and Size are using (1)
> Mean and Sigma are using (2)
>
> It looks like both methods (1) or (2) could have been used...
> for any of the parameters.
>
>
> What are the advantages/disadvantages that you found on
> each method ?

Actually, I was just trying to figure that out... I think the main 
distinction was whether or not the parameters being passed were a "list" 
rather than an "object".

For instance:

  itkSetMacro(Sigma, ArrayType);
  itkGetMacro(Sigma, ArrayType);
  itkSetMacro(Mean, ArrayType);
  itkGetMacro(Mean, ArrayType);

are all collections of parameters specifying parameters of the Gaussian. 
Unlike Points or Vectors, and Array can be thought of as "a bunch of 
numbers". In the spatial function class itself, these values are stored as:

  /** The standard deviation in each direction. */
  ArrayType m_Sigma;

  /** The mean in each direction. */
  ArrayType m_Mean;

So, it makes sense to have the image source take the same type as the 
function.

The _real_ question is why I used SetVectorMacro for the other variables, 
rather than an array. I think Vector for the origin makes sense (since the 
origin is a single "thing") but I don't know why I used vectors for spacing 
and size, which fall under the "bunch of numbers" category.

I don't know that there's any real advantage to either approach, at least 
from a coding standpoint.

> BTW: A minor change in style was made to your class: "TArrayType"
> was being used to define a type, as opposed to just "ArrayType".

I have a question about this: there seem to be two competing notation 
styles. From itkImage.h:

template <class TPixel,...
typedef TPixel PixelType;

What is the difference between the two forms?

-Damion-