# C Array Removal

C arrays are not used any more as method parameter or return value.

There are several places in ITK where C arrays are used as method parameter or return value instead of stronger array like types, like itk::Index, itk::Size, itk::Offset, itk::FixedArray or itk::Array. Using stronger types makes more efficient the error checking at compile time and enhance the user integration by using the same types and conventions than elsewhere.

More important, the C arrays are not wrappable without further information that we don't have at wrap time. As a consequence, the classes which are using them are at best partially usable in Python, Java or Tcl. Using stronger types completely fix that problem.

Backward compatibility is fully preserved for input parameters, but not for return values. Usually, return values will require an additional call to GetDataPointer(), m_Offset, m_Size or m_Index to be fully compatible.

However, to pass and get the values to or from the filter it is adviced to rather use the stronger type (itk::Index, itk::Size, itk::Offset, itk::FixedArray or itk::Array) used to replace the C array instead of the legacy C array.
const long * outputOffset = filter->GetOutputOffset(); const long * outputIndex = filter->GetOutputIndex(); const unsigned long * outputSize = filter->GetOutputSize(); const float * outweights = filter->GetWeights(); const double * spacingValue = import->GetSpacing(); const double * originValue = import->GetOrigin();
const long * outputOffset = filter->GetOutputOffset().m_Offset; const long * outputIndex = filter->GetOutputIndex().m_Index; const unsigned long * outputSize = filter->GetOutputSize().m_Size; const float * outweights = filter->GetWeights().GetDataPointer(); const double * spacingValue = import->GetSpacing().GetDataPointer(); const double * originValue = import->GetOrigin().GetDataPointer();
Id1f1993ab89fac86dfcd3225dd30e352f01a433e
Code/Algorithms/itkFastChamferDistanceImageFilter.h Code/Algorithms/itkMultiResolutionPDEDeformableRegistration.h Code/Algorithms/itkMultiResolutionPDEDeformableRegistration.txx Code/Algorithms/itkPDEDeformableRegistrationFilter.h Code/BasicFilters/itkBilateralImageFilter.txx Code/BasicFilters/itkChangeInformationImageFilter.h Code/BasicFilters/itkChangeInformationImageFilter.txx Code/BasicFilters/itkDisplacementFieldJacobianDeterminantFilter.h Code/BasicFilters/itkDisplacementFieldJacobianDeterminantFilter.txx Code/BasicFilters/itkExpandImageFilter.h Code/BasicFilters/itkExpandImageFilter.txx Code/BasicFilters/itkGaussianImageSource.h Code/BasicFilters/itkGaussianImageSource.txx Code/BasicFilters/itkGradientImageToBloxBoundaryPointImageFilter.h Code/BasicFilters/itkGradientImageToBloxBoundaryPointImageFilter.txx Code/BasicFilters/itkGrayscaleMorphologicalClosingImageFilter.txx Code/BasicFilters/itkGrayscaleMorphologicalOpeningImageFilter.txx Code/BasicFilters/itkImportImageFilter.h Code/BasicFilters/itkImportImageFilter.txx Code/BasicFilters/itkPadImageFilter.h Code/BasicFilters/itkReconstructionImageFilter.txx Code/BasicFilters/itkShrinkImageFilter.h Code/BasicFilters/itkShrinkImageFilter.txx Code/BasicFilters/itkVectorExpandImageFilter.h Code/BasicFilters/itkVectorExpandImageFilter.txx Code/BasicFilters/itkVectorGradientMagnitudeImageFilter.h Code/BasicFilters/itkVectorGradientMagnitudeImageFilter.txx Code/IO/itkStimulateImageIO.h Code/Review/itkBinaryMorphologicalClosingImageFilter.txx Code/Review/itkWarpHarmonicEnergyCalculator.h Code/Review/itkWarpHarmonicEnergyCalculator.txx Examples/Registration/DeformableRegistration16.cxx Migration/CArrayRemoval.xml Testing/Code/Algorithms/itkFastChamferDistanceImageFilterTest.cxx Testing/Code/BasicFilters/itkChangeInformationImageFilterTest.cxx Testing/Code/BasicFilters/itkImportImageTest.cxx