Skip to content

Commit

Permalink
STYLE: Prefer c++11 'using' to 'typedef'
Browse files Browse the repository at this point in the history
The check converts the usage of typedef with using keyword.

SRCDIR= #My local SRC
BLDDIR= #My local BLD

cd
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-using  -header-filter=.* -fix
# https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-using.html
  • Loading branch information
hjmjohnson committed Feb 22, 2020
1 parent 225db63 commit 6f1a8da
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/Compatibility/Deprecated/ResampleITKVectorImage/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
int
main(int, char *[])
{
typedef itk::VectorImage<double, 2> VectorImageType;
using VectorImageType = itk::VectorImage<double, 2>;

VectorImageType::Pointer image = VectorImageType::New();
itk::Index<2> start;
Expand All @@ -37,8 +37,8 @@ main(int, char *[])
image->Allocate();
// image->FillBuffer(itk::NumericTraits<VectorImageType::InternalPixelType>::Zero);

typedef itk::ResampleImageFilter<VectorImageType, VectorImageType> ResampleFilterType;
ResampleFilterType::Pointer vectorResampleFilter = ResampleFilterType::New();
using ResampleFilterType = itk::ResampleImageFilter<VectorImageType, VectorImageType>;
ResampleFilterType::Pointer vectorResampleFilter = ResampleFilterType::New();
vectorResampleFilter->SetInput(image);
vectorResampleFilter->Update();

Expand Down
14 changes: 7 additions & 7 deletions src/Compatibility/Deprecated/ResampleRGBImage/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# include "QuickView.h"
#endif

typedef itk::Image<itk::RGBPixel<unsigned char>, 2> ImageType;
using ImageType = itk::Image<itk::RGBPixel<unsigned char>, 2>;

static void
CreateImage(ImageType::Pointer image);
Expand All @@ -45,8 +45,8 @@ main(int argc, char * argv[])
}
else
{
typedef itk::ImageFileReader<ImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
using ReaderType = itk::ImageFileReader<ImageType>;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
reader->Update();
input = reader->GetOutput();
Expand All @@ -69,16 +69,16 @@ main(int argc, char * argv[])
outputSpacing[0] = input->GetSpacing()[0] * (static_cast<double>(inputSize[0]) / static_cast<double>(outputSize[0]));
outputSpacing[1] = input->GetSpacing()[1] * (static_cast<double>(inputSize[1]) / static_cast<double>(outputSize[1]));

typedef itk::IdentityTransform<double, 2> TransformType;
typedef itk::VectorResampleImageFilter<ImageType, ImageType> ResampleImageFilterType;
ResampleImageFilterType::Pointer resample = ResampleImageFilterType::New();
using TransformType = itk::IdentityTransform<double, 2>;
using ResampleImageFilterType = itk::VectorResampleImageFilter<ImageType, ImageType>;
ResampleImageFilterType::Pointer resample = ResampleImageFilterType::New();
resample->SetInput(input);
resample->SetSize(outputSize);
resample->SetOutputSpacing(outputSpacing);
resample->SetTransform(TransformType::New());
resample->UpdateLargestPossibleRegion();

typedef itk::VectorNearestNeighborInterpolateImageFunction<ImageType, double> NearestInterpolatorType;
using NearestInterpolatorType = itk::VectorNearestNeighborInterpolateImageFunction<ImageType, double>;
NearestInterpolatorType::Pointer nnInterpolator = NearestInterpolatorType::New();

ResampleImageFilterType::Pointer resampleNN = ResampleImageFilterType::New();
Expand Down
8 changes: 4 additions & 4 deletions src/Core/Transform/TranslateAVectorImage/Code.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
int
main(int, char *[])
{
typedef itk::CovariantVector<double, 3> VectorType;
typedef itk::Image<VectorType, 2> VectorImageType;
using VectorType = itk::CovariantVector<double, 3>;
using VectorImageType = itk::Image<VectorType, 2>;

VectorImageType::Pointer image = VectorImageType::New();
itk::Index<2> start;
Expand All @@ -46,8 +46,8 @@ main(int, char *[])
translation[1] = 20;
transform->Translate(translation);

typedef itk::ResampleImageFilter<VectorImageType, VectorImageType> ResampleFilterType;
ResampleFilterType::Pointer vectorResampleFilter = ResampleFilterType::New();
using ResampleFilterType = itk::ResampleImageFilter<VectorImageType, VectorImageType>;
ResampleFilterType::Pointer vectorResampleFilter = ResampleFilterType::New();
vectorResampleFilter->SetInput(image);
vectorResampleFilter->SetSize(image->GetLargestPossibleRegion().GetSize());
vectorResampleFilter->SetTransform(transform);
Expand Down

0 comments on commit 6f1a8da

Please sign in to comment.