[Insight-users] itkConceptChecking.h
    Jill Goldschneider 327 
    jrgold at insightful.com
       
    Tue Aug 10 19:13:23 EDT 2004
    
    
  
Hi,
I have a queston about itkConceptChecking.h.
My filter is templated over input/output image types that
must be in vector format, that is, each pixel is a vector.
It is necessary that the input/output image dimensions be
the same and that the length of vectors of the input/output
pixels be the same.  However, it isn't necessary to have
the vector type be the same type, so I do not want to use
Concept::SameType.  I would like to use something like
the existing Concept::SameDimension.
This works:
  itkStaticConstMacro(InputImageDimension, unsigned int,
                      TInputImage::ImageDimension);
  itkStaticConstMacro(OutputImageDimension, unsigned int,
                      TOutputImage::ImageDimension);
  itkConceptMacro(SameDimension,
    (Concept::SameDimension<InputImageDimension,OutputImageDimension>));
And this is what I'd like to do (it won't compile - duplicate enum value
for SameDimension)
  typedef typename TInputImage::PixelType InputImagePixelType;
  typedef typename TInputImage::PixelType::VectorType InputImageVectorType;
  itkStaticConstMacro(InputImageVectorDimension, unsigned int,
                      InputImagePixelType::Dimension);
  typedef typename TOutputImage::PixelType OutputImagePixelType;
  typedef typename TOutputImage::PixelType::VectorType OutputImageVectorType;
  itkStaticConstMacro(OutputImageVectorDimension, unsigned int,
                      OutputImagePixelType::Dimension);
  itkConceptMacro(SameDimension,
    (Concept::SameDimension<InputImageVectorDimension,
                            OutputImageVectorDimension>));
This is what currently have in my code to avoid vector mismatch problem
  int j = InputImageVectorDimension;
  int k = OutputImageVectorDimension;
  if( j != k ) itkExceptionMacro( << "Invalid vector length" );
The above code works - but I've been challenged to use the concept
checking macros.  Is it reasonable to be able to do the check I want 
using concept checking?  If so - how?
Thanks!
Jill
    
    
More information about the Insight-users
mailing list