|
|
Line 1: |
Line 1: |
| This does not work because pixels are expected to have a ::Dimension, and this is only the case with itk::Image<itk::Vector<dim>, imageDim>, (where in the case of itk::VectorImage<type, dim> the pixels are of type itkVariableLengthVector).
| | {{warning|1=The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/* pages likely require ITK version 4.13 or earlier releases. In many cases, the examples on this page no longer conform to the best practices for modern ITK versions. |
| | | }} |
| ==VectorCastImageFilter.cxx==
| |
| <source lang="cpp">
| |
| #include "itkVectorImage.h"
| |
| #include "itkVectorCastImageFilter.h"
| |
| | |
| int main(int argc, char *argv[])
| |
| {
| |
| typedef itk::VectorImage<unsigned char, 2> UnsignedCharVectorImageType; | |
| typedef itk::VectorImage<float, 2> FloatVectorImageType;
| |
| | |
| FloatVectorImageType::Pointer image = FloatVectorImageType::New();
| |
| | |
| typedef itk::VectorCastImageFilter< FloatVectorImageType, UnsignedCharVectorImageType > VectorCastImageFilterType;
| |
| VectorCastImageFilterType::Pointer vectorCastImageFilter = VectorCastImageFilterType::New();
| |
| vectorCastImageFilter->SetInput(image);
| |
| vectorCastImageFilter->Update();
| |
| | |
| return EXIT_SUCCESS;
| |
| }
| |
| | |
| </source>
| |
| | |
| {{ITKCMakeLists|{{SUBPAGENAME}}}}
| |