| 71 | } // end UpdateFilterNTimes |
| 72 | |
| 73 | int |
| 74 | main(int argc, char * argv[]) |
| 75 | { |
| 76 | // Check arguments for help |
| 77 | if (argc < 4) |
| 78 | { |
| 79 | std::cerr << "ERROR: insufficient command line arguments.\n" |
| 80 | << " inputFileName outputNameCPU outputNameGPU" << std::endl; |
| 81 | return EXIT_FAILURE; |
| 82 | } |
| 83 | |
| 84 | // Setup for debugging |
| 85 | itk::SetupForDebugging(); |
| 86 | |
| 87 | // Create and check OpenCL context |
| 88 | if (!itk::CreateContext()) |
| 89 | { |
| 90 | return EXIT_FAILURE; |
| 91 | } |
| 92 | const itk::OpenCLContextScopeGuard openCLContextScopeGuard{}; |
| 93 | |
| 94 | /** Get the command line arguments. */ |
| 95 | const std::string inputFileName = argv[1]; |
| 96 | const std::string outputFileNameCPU = argv[2]; |
| 97 | const std::string outputFileNameGPU = argv[3]; |
| 98 | const unsigned int numberOfLevels = 4; |
| 99 | const bool useMultiResolutionRescaleSchedule = true; |
| 100 | const bool useMultiResolutionSmoothingSchedule = true; |
| 101 | const bool useShrinkImageFilter = false; |
| 102 | const bool computeOnlyForCurrentLevel = true; |
| 103 | const double epsilon = 1e-3; |
| 104 | const unsigned int runTimes = 5; |
| 105 | |
| 106 | std::cout << std::showpoint << std::setprecision(4); |
| 107 | |
| 108 | // Typedefs. |
| 109 | const unsigned int Dimension = 3; |
| 110 | using InputPixelType = float; |
| 111 | using OutputPixelType = float; |
| 112 | using InputImageType = itk::Image<InputPixelType, Dimension>; |
| 113 | using OutputImageType = itk::Image<OutputPixelType, Dimension>; |
| 114 | using GPUInputImageType = itk::GPUImage<InputPixelType, Dimension>; |
| 115 | using GPUOutputImageType = itk::GPUImage<OutputPixelType, Dimension>; |
| 116 | |
| 117 | // CPU Typedefs |
| 118 | using PrecisionType = float; |
| 119 | using FilterType = itk::GenericMultiResolutionPyramidImageFilter<InputImageType, OutputImageType, PrecisionType>; |
| 120 | using GPUFilterType = |
| 121 | itk::GenericMultiResolutionPyramidImageFilter<GPUInputImageType, GPUOutputImageType, PrecisionType>; |
| 122 | |
| 123 | // Read image |
| 124 | InputImageType::Pointer inputImage = itk::ReadImage<InputImageType>(inputFileName); |
| 125 | |
| 126 | // Construct the filter |
| 127 | auto cpuFilter = FilterType::New(); |
| 128 | |
| 129 | using RescaleScheduleType = FilterType::RescaleScheduleType; |
| 130 | using SmoothingScheduleType = FilterType::SmoothingScheduleType; |
nothing calls this directly
no test coverage detected