[Insight-developers] Hi I m writing an itk filter which required the different dimension of input and output images.

Williams, Norman K norman-k-williams at uiowa.edu
Mon Jul 18 09:53:37 EDT 2011


you need to template your class over both the input image type and the
output image type.


Either that, or it should work to do something like this:

template <class TInputImage>
testClass
{
public:
  static const int OutputDimension(TInputImage::ImageDimension - 1);
  typedef double OutputVectorElementType;
  typedef VectorImage<OutputVectorElementType,OutputDimension>
OutputImageType;
};

Now I didn't actually compile this example, but static const scalars are
legal in C++ to use as template parameters, because their value can be
determined at compile time.

On 7/17/11 8:19 PM, "丁昊" <tin.dinghao at gmail.com> wrote:

>Hi all
>I m writing an itk filter which required the input dimension to be
>different from the output dimension.
>
>I would like to use the vector image as the output type, but the
>declaration of the vector image's dimension need to be static const.
>
>I know I can use the itkStaticConstMacro, but the output image's
>dimension need to be calculated in the GenerateData() funktion.
>
>How am I suppose to implement this?
>
>
>Hao
>_______________________________________________
>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.
________________________________


More information about the Insight-developers mailing list