Skip to content

Commit 6f1a8da

Browse files
committed
STYLE: Prefer c++11 'using' to 'typedef'
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
1 parent 225db63 commit 6f1a8da

File tree

3 files changed

+14
-14
lines changed
  • src
    • Compatibility/Deprecated
    • Core/Transform/TranslateAVectorImage

3 files changed

+14
-14
lines changed

src/Compatibility/Deprecated/ResampleITKVectorImage/Code.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
int
2323
main(int, char *[])
2424
{
25-
typedef itk::VectorImage<double, 2> VectorImageType;
25+
using VectorImageType = itk::VectorImage<double, 2>;
2626

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

40-
typedef itk::ResampleImageFilter<VectorImageType, VectorImageType> ResampleFilterType;
41-
ResampleFilterType::Pointer vectorResampleFilter = ResampleFilterType::New();
40+
using ResampleFilterType = itk::ResampleImageFilter<VectorImageType, VectorImageType>;
41+
ResampleFilterType::Pointer vectorResampleFilter = ResampleFilterType::New();
4242
vectorResampleFilter->SetInput(image);
4343
vectorResampleFilter->Update();
4444

src/Compatibility/Deprecated/ResampleRGBImage/Code.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# include "QuickView.h"
2727
#endif
2828

29-
typedef itk::Image<itk::RGBPixel<unsigned char>, 2> ImageType;
29+
using ImageType = itk::Image<itk::RGBPixel<unsigned char>, 2>;
3030

3131
static void
3232
CreateImage(ImageType::Pointer image);
@@ -45,8 +45,8 @@ main(int argc, char * argv[])
4545
}
4646
else
4747
{
48-
typedef itk::ImageFileReader<ImageType> ReaderType;
49-
ReaderType::Pointer reader = ReaderType::New();
48+
using ReaderType = itk::ImageFileReader<ImageType>;
49+
ReaderType::Pointer reader = ReaderType::New();
5050
reader->SetFileName(argv[1]);
5151
reader->Update();
5252
input = reader->GetOutput();
@@ -69,16 +69,16 @@ main(int argc, char * argv[])
6969
outputSpacing[0] = input->GetSpacing()[0] * (static_cast<double>(inputSize[0]) / static_cast<double>(outputSize[0]));
7070
outputSpacing[1] = input->GetSpacing()[1] * (static_cast<double>(inputSize[1]) / static_cast<double>(outputSize[1]));
7171

72-
typedef itk::IdentityTransform<double, 2> TransformType;
73-
typedef itk::VectorResampleImageFilter<ImageType, ImageType> ResampleImageFilterType;
74-
ResampleImageFilterType::Pointer resample = ResampleImageFilterType::New();
72+
using TransformType = itk::IdentityTransform<double, 2>;
73+
using ResampleImageFilterType = itk::VectorResampleImageFilter<ImageType, ImageType>;
74+
ResampleImageFilterType::Pointer resample = ResampleImageFilterType::New();
7575
resample->SetInput(input);
7676
resample->SetSize(outputSize);
7777
resample->SetOutputSpacing(outputSpacing);
7878
resample->SetTransform(TransformType::New());
7979
resample->UpdateLargestPossibleRegion();
8080

81-
typedef itk::VectorNearestNeighborInterpolateImageFunction<ImageType, double> NearestInterpolatorType;
81+
using NearestInterpolatorType = itk::VectorNearestNeighborInterpolateImageFunction<ImageType, double>;
8282
NearestInterpolatorType::Pointer nnInterpolator = NearestInterpolatorType::New();
8383

8484
ResampleImageFilterType::Pointer resampleNN = ResampleImageFilterType::New();

src/Core/Transform/TranslateAVectorImage/Code.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
int
2626
main(int, char *[])
2727
{
28-
typedef itk::CovariantVector<double, 3> VectorType;
29-
typedef itk::Image<VectorType, 2> VectorImageType;
28+
using VectorType = itk::CovariantVector<double, 3>;
29+
using VectorImageType = itk::Image<VectorType, 2>;
3030

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

49-
typedef itk::ResampleImageFilter<VectorImageType, VectorImageType> ResampleFilterType;
50-
ResampleFilterType::Pointer vectorResampleFilter = ResampleFilterType::New();
49+
using ResampleFilterType = itk::ResampleImageFilter<VectorImageType, VectorImageType>;
50+
ResampleFilterType::Pointer vectorResampleFilter = ResampleFilterType::New();
5151
vectorResampleFilter->SetInput(image);
5252
vectorResampleFilter->SetSize(image->GetLargestPossibleRegion().GetSize());
5353
vectorResampleFilter->SetTransform(transform);

0 commit comments

Comments
 (0)