+ clitkExceptionMacro("Autocrop is not implemented for vector fields");
+ return NULL;
+}
+//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
+template <class ImageType>
+typename clitk::CropImageGenericFilter::AutoCrop<ImageType>::ImagePointer
+clitk::CropImageGenericFilter::AutoCrop<ImageType>::Do(args_info_type &argsInfo, ImagePointer input, PixelDimType<1> *)
+{
+ if (argsInfo.boundingBox_given)
+ clitkExceptionMacro("Do not use --BG and --boundingBox at the same time");
+ if (argsInfo.lower_given)
+ clitkExceptionMacro("Do not use --BG and --lower at the same time");
+ if (argsInfo.upper_given)
+ clitkExceptionMacro("Do not use --BG and --upper at the same time");
+ typedef clitk::AutoCropFilter<ImageType> FilterType;
+ typename FilterType::Pointer filter = FilterType::New();
+ filter->SetInput(input);
+ filter->SetBackgroundValue(argsInfo.BG_arg);
+ filter->Update();
+ return filter->GetOutput();
+}
+//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
+// Update with the number of dimensions and the pixeltype
+//--------------------------------------------------------------------
+template<class ImageType>
+void clitk::CropImageGenericFilter::UpdateWithInputImageType()
+{
+ // Reading input
+ typename ImageType::Pointer input = this->template GetInput<ImageType>(0);
+ typename ImageType::RegionType input_region = input->GetLargestPossibleRegion();