Skip to content

Commit e017621

Browse files
committed
STYLE: run clang-format on ImageRegistration1.cxx
1 parent 5683175 commit e017621

File tree

1 file changed

+52
-71
lines changed

1 file changed

+52
-71
lines changed

Examples/Registration/ImageRegistration1.cxx

+52-71
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
*/
2020

2121

22-
2322
// Software Guide : BeginCommandLineArgs
2423
// INPUTS: {QB_Suburb.png}
2524
// INPUTS: {QB_Suburb13x17y.png}
@@ -68,52 +67,51 @@
6867
class CommandIterationUpdate : public itk::Command
6968
{
7069
public:
71-
typedef CommandIterationUpdate Self;
72-
typedef itk::Command Superclass;
70+
typedef CommandIterationUpdate Self;
71+
typedef itk::Command Superclass;
7372
typedef itk::SmartPointer<Self> Pointer;
7473
itkNewMacro(Self);
7574

7675
protected:
77-
CommandIterationUpdate() {}
76+
CommandIterationUpdate()
77+
{
78+
}
7879

7980
public:
80-
8181
typedef itk::RegularStepGradientDescentOptimizer OptimizerType;
82-
typedef const OptimizerType * OptimizerPointer;
82+
typedef const OptimizerType* OptimizerPointer;
8383

84-
void Execute(itk::Object *caller, const itk::EventObject& event) override
84+
void Execute(itk::Object* caller, const itk::EventObject& event) override
8585
{
86-
Execute((const itk::Object *) caller, event);
86+
Execute((const itk::Object*)caller, event);
8787
}
8888

89-
void Execute(const itk::Object * object, const itk::EventObject& event) override
89+
void Execute(const itk::Object* object, const itk::EventObject& event) override
9090
{
91-
OptimizerPointer optimizer =
92-
dynamic_cast<OptimizerPointer>(object);
91+
OptimizerPointer optimizer = dynamic_cast<OptimizerPointer>(object);
9392

9493
if (!itk::IterationEvent().CheckEvent(&event))
95-
{
94+
{
9695
return;
97-
}
96+
}
9897

9998
std::cout << optimizer->GetCurrentIteration() << " = ";
10099
std::cout << optimizer->GetValue() << " : ";
101100
std::cout << optimizer->GetCurrentPosition() << std::endl;
102101
}
103-
104102
};
105103

106-
int main(int argc, char *argv[])
104+
int main(int argc, char* argv[])
107105
{
108106
if (argc < 4)
109-
{
107+
{
110108
std::cerr << "Missing Parameters " << std::endl;
111109
std::cerr << "Usage: " << argv[0];
112110
std::cerr << " fixedImageFile movingImageFile ";
113111
std::cerr << "outputImagefile [differenceImageAfter]";
114112
std::cerr << "[differenceImageBefore]" << std::endl;
115113
return 1;
116-
}
114+
}
117115

118116
// Software Guide : BeginLatex
119117
//
@@ -125,7 +123,7 @@ int main(int argc, char *argv[])
125123

126124
// Software Guide : BeginCodeSnippet
127125
const unsigned int Dimension = 2;
128-
typedef float PixelType;
126+
typedef float PixelType;
129127
// Software Guide : EndCodeSnippet
130128

131129
// Software Guide : BeginLatex
@@ -170,9 +168,7 @@ int main(int argc, char *argv[])
170168
// Software Guide : EndLatex
171169

172170
// Software Guide : BeginCodeSnippet
173-
typedef itk::MeanSquaresImageToImageMetric<
174-
FixedImageType,
175-
MovingImageType> MetricType;
171+
typedef itk::MeanSquaresImageToImageMetric<FixedImageType, MovingImageType> MetricType;
176172
// Software Guide : EndCodeSnippet
177173

178174
// Software Guide : BeginLatex
@@ -183,9 +179,7 @@ int main(int argc, char *argv[])
183179
// Software Guide : EndLatex
184180

185181
// Software Guide : BeginCodeSnippet
186-
typedef itk::LinearInterpolateImageFunction<
187-
MovingImageType,
188-
double> InterpolatorType;
182+
typedef itk::LinearInterpolateImageFunction<MovingImageType, double> InterpolatorType;
189183
// Software Guide : EndCodeSnippet
190184

191185
// Software Guide : BeginLatex
@@ -197,9 +191,7 @@ int main(int argc, char *argv[])
197191
// Software Guide : EndLatex
198192

199193
// Software Guide : BeginCodeSnippet
200-
typedef itk::ImageRegistrationMethod<
201-
FixedImageType,
202-
MovingImageType> RegistrationType;
194+
typedef itk::ImageRegistrationMethod<FixedImageType, MovingImageType> RegistrationType;
203195
// Software Guide : EndCodeSnippet
204196

205197
// Software Guide : BeginLatex
@@ -211,11 +203,11 @@ int main(int argc, char *argv[])
211203
// Software Guide : EndLatex
212204

213205
// Software Guide : BeginCodeSnippet
214-
MetricType::Pointer metric = MetricType::New();
215-
TransformType::Pointer transform = TransformType::New();
216-
OptimizerType::Pointer optimizer = OptimizerType::New();
217-
InterpolatorType::Pointer interpolator = InterpolatorType::New();
218-
RegistrationType::Pointer registration = RegistrationType::New();
206+
MetricType::Pointer metric = MetricType::New();
207+
TransformType::Pointer transform = TransformType::New();
208+
OptimizerType::Pointer optimizer = OptimizerType::New();
209+
InterpolatorType::Pointer interpolator = InterpolatorType::New();
210+
RegistrationType::Pointer registration = RegistrationType::New();
219211
// Software Guide : EndCodeSnippet
220212

221213
// Software Guide : BeginLatex
@@ -239,8 +231,8 @@ int main(int argc, char *argv[])
239231

240232
typedef otb::ImageFileReader<FixedImageType> FixedImageReaderType;
241233
typedef otb::ImageFileReader<MovingImageType> MovingImageReaderType;
242-
FixedImageReaderType::Pointer fixedImageReader = FixedImageReaderType::New();
243-
MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New();
234+
FixedImageReaderType::Pointer fixedImageReader = FixedImageReaderType::New();
235+
MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New();
244236

245237
fixedImageReader->SetFileName(argv[1]);
246238
movingImageReader->SetFileName(argv[2]);
@@ -255,11 +247,9 @@ int main(int argc, char *argv[])
255247
// Software Guide : EndLatex
256248

257249
// Software Guide : BeginCodeSnippet
258-
typedef itk::MeanImageFilter<
259-
FixedImageType, FixedImageType> FixedFilterType;
250+
typedef itk::MeanImageFilter<FixedImageType, FixedImageType> FixedFilterType;
260251

261-
typedef itk::MeanImageFilter<
262-
MovingImageType, MovingImageType> MovingFilterType;
252+
typedef itk::MeanImageFilter<MovingImageType, MovingImageType> MovingFilterType;
263253

264254
FixedFilterType::Pointer fixedFilter = FixedFilterType::New();
265255
MovingFilterType::Pointer movingFilter = MovingFilterType::New();
@@ -313,8 +303,7 @@ int main(int argc, char *argv[])
313303

314304
// Software Guide : BeginCodeSnippet
315305
fixedFilter->Update();
316-
registration->SetFixedImageRegion(
317-
fixedFilter->GetOutput()->GetBufferedRegion());
306+
registration->SetFixedImageRegion(fixedFilter->GetOutput()->GetBufferedRegion());
318307
// Software Guide : EndCodeSnippet
319308

320309
// Software Guide : BeginLatex
@@ -336,10 +325,10 @@ int main(int argc, char *argv[])
336325

337326
// Software Guide : BeginCodeSnippet
338327
typedef RegistrationType::ParametersType ParametersType;
339-
ParametersType initialParameters(transform->GetNumberOfParameters());
328+
ParametersType initialParameters(transform->GetNumberOfParameters());
340329

341-
initialParameters[0] = 0.0; // Initial offset in mm along X
342-
initialParameters[1] = 0.0; // Initial offset in mm along Y
330+
initialParameters[0] = 0.0; // Initial offset in mm along X
331+
initialParameters[1] = 0.0; // Initial offset in mm along Y
343332

344333
registration->SetInitialTransformParameters(initialParameters);
345334
// Software Guide : EndCodeSnippet
@@ -412,15 +401,15 @@ int main(int argc, char *argv[])
412401

413402
// Software Guide : BeginCodeSnippet
414403
try
415-
{
404+
{
416405
registration->Update();
417-
}
406+
}
418407
catch (itk::ExceptionObject& err)
419-
{
408+
{
420409
std::cerr << "ExceptionObject caught !" << std::endl;
421410
std::cerr << err << std::endl;
422411
return -1;
423-
}
412+
}
424413
// Software Guide : EndCodeSnippet
425414

426415
// Software Guide : BeginLatex
@@ -488,10 +477,10 @@ int main(int argc, char *argv[])
488477
// Print out results
489478
//
490479
std::cout << "Result = " << std::endl;
491-
std::cout << " Translation X = " << TranslationAlongX << std::endl;
492-
std::cout << " Translation Y = " << TranslationAlongY << std::endl;
480+
std::cout << " Translation X = " << TranslationAlongX << std::endl;
481+
std::cout << " Translation Y = " << TranslationAlongY << std::endl;
493482
std::cout << " Iterations = " << numberOfIterations << std::endl;
494-
std::cout << " Metric value = " << bestValue << std::endl;
483+
std::cout << " Metric value = " << bestValue << std::endl;
495484

496485
// Software Guide : BeginLatex
497486
//
@@ -542,9 +531,7 @@ int main(int argc, char *argv[])
542531
// Software Guide : EndLatex
543532

544533
// Software Guide : BeginCodeSnippet
545-
typedef itk::ResampleImageFilter<
546-
MovingImageType,
547-
FixedImageType> ResampleFilterType;
534+
typedef itk::ResampleImageFilter<MovingImageType, FixedImageType> ResampleFilterType;
548535
// Software Guide : EndCodeSnippet
549536

550537
// Software Guide : BeginLatex
@@ -624,11 +611,10 @@ int main(int argc, char *argv[])
624611
// Software Guide : EndLatex
625612

626613
// Software Guide : BeginCodeSnippet
627-
typedef unsigned char OutputPixelType;
628-
typedef otb::Image<OutputPixelType, Dimension> OutputImageType;
629-
typedef itk::CastImageFilter<FixedImageType,
630-
OutputImageType> CastFilterType;
631-
typedef otb::ImageFileWriter<OutputImageType> WriterType;
614+
typedef unsigned char OutputPixelType;
615+
typedef otb::Image<OutputPixelType, Dimension> OutputImageType;
616+
typedef itk::CastImageFilter<FixedImageType, OutputImageType> CastFilterType;
617+
typedef otb::ImageFileWriter<OutputImageType> WriterType;
632618
// Software Guide : EndCodeSnippet
633619

634620
// Software Guide : BeginLatex
@@ -639,8 +625,8 @@ int main(int argc, char *argv[])
639625
// Software Guide : EndLatex
640626

641627
// Software Guide : BeginCodeSnippet
642-
WriterType::Pointer writer = WriterType::New();
643-
CastFilterType::Pointer caster = CastFilterType::New();
628+
WriterType::Pointer writer = WriterType::New();
629+
CastFilterType::Pointer caster = CastFilterType::New();
644630
// Software Guide : EndCodeSnippet
645631

646632
writer->SetFileName(argv[3]);
@@ -680,10 +666,7 @@ int main(int argc, char *argv[])
680666
// Software Guide : EndLatex
681667

682668
// Software Guide : BeginCodeSnippet
683-
typedef itk::SubtractImageFilter<
684-
FixedImageType,
685-
FixedImageType,
686-
FixedImageType> DifferenceFilterType;
669+
typedef itk::SubtractImageFilter<FixedImageType, FixedImageType, FixedImageType> DifferenceFilterType;
687670

688671
DifferenceFilterType::Pointer difference = DifferenceFilterType::New();
689672

@@ -715,9 +698,7 @@ int main(int argc, char *argv[])
715698
// Software Guide : EndLatex
716699

717700
// Software Guide : BeginCodeSnippet
718-
typedef itk::RescaleIntensityImageFilter<
719-
FixedImageType,
720-
OutputImageType> RescalerType;
701+
typedef itk::RescaleIntensityImageFilter<FixedImageType, OutputImageType> RescalerType;
721702

722703
RescalerType::Pointer intensityRescaler = RescalerType::New();
723704

@@ -740,10 +721,10 @@ int main(int argc, char *argv[])
740721
// Software Guide : EndCodeSnippet
741722

742723
if (argc > 4)
743-
{
724+
{
744725
writer2->SetFileName(argv[4]);
745726
writer2->Update();
746-
}
727+
}
747728

748729
// Software Guide : BeginLatex
749730
//
@@ -765,10 +746,10 @@ int main(int argc, char *argv[])
765746
// Software Guide : EndCodeSnippet
766747

767748
if (argc > 5)
768-
{
749+
{
769750
writer2->SetFileName(argv[5]);
770751
writer2->Update();
771-
}
752+
}
772753

773754
// Software Guide : BeginLatex
774755
//

0 commit comments

Comments
 (0)