X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=filters%2FclitkImageFillRegionGenericFilter.txx;h=79defadc71b4687f34377af9e8fe46d1741df7ba;hb=996a050b898c093fa00462b1a4aa78b9a515cb2a;hp=4d81f0e8b947408b220b48c886dcef5284103951;hpb=931a42358442f4ee4f314613c991c838d4b4e3b7;p=clitk.git diff --git a/filters/clitkImageFillRegionGenericFilter.txx b/filters/clitkImageFillRegionGenericFilter.txx index 4d81f0e..79defad 100644 --- a/filters/clitkImageFillRegionGenericFilter.txx +++ b/filters/clitkImageFillRegionGenericFilter.txx @@ -20,127 +20,4 @@ * -------------------------------------------------*/ -//-------------------------------------------------------------------- -template -void ImageFillRegionGenericFilter::Update_WithDim() { -#define TRY_TYPE(TYPE) \ - if (IsSameType(mPixelTypeName)) { Update_WithDimAndPixelType(); return; } - // TRY_TYPE(signed char); - // TRY_TYPE(uchar); - TRY_TYPE(short); - //TRY_TYPE(ushort); - // TRY_TYPE(int); - // TRY_TYPE(unsigned int); - TRY_TYPE(float); - // TRY_TYPE(double); -#undef TRY_TYPE - - std::string list = CreateListOfTypes(); - std::cerr << "Error, I don't know the type '" << mPixelTypeName << "' for the input image '" - << mInputFilenames[0] << "'." << std::endl << "Known types are " << list << std::endl; - exit(0); -} -//-------------------------------------------------------------------- - -//-------------------------------------------------------------------- -template -void ImageFillRegionGenericFilter::Update_WithDimAndPixelType() { - - // Spheric region - if (mSphericRegion) return Update_WithDimAndPixelType_SphericRegion(); - - // Read input - typedef itk::Image ImageType; - typename ImageType::Pointer input = GetInput(0); - - // Get pixel value in correct type - PixelType value = PixelTypeDownCast(mPixelValue); - - // Get region - typedef typename ImageType::RegionType RegionType; - typedef typename ImageType::SizeType SizeType; - typedef typename ImageType::IndexType IndexType; - RegionType region; - SizeType size; - IndexType start; - for(unsigned int i=0; i IteratorType; - IteratorType it(input, region); - it.GoToBegin(); - while (!it.IsAtEnd()) { - it.Set(value); - ++it; - } - - // Write results - SetNextOutput(input); -} -//-------------------------------------------------------------------- - -//-------------------------------------------------------------------- -template -void ImageFillRegionGenericFilter::Update_WithDimAndPixelType_SphericRegion() { - - // Read input - typedef itk::Image ImageType; - //typename ImageType::Pointer input = clitk::readImage(mInputFilenames[0], mIOVerbose); - typename ImageType::Pointer input = GetInput(0); - - // Get pixel value in correct type - PixelType value = PixelTypeDownCast(mPixelValue); - - // Centered? - if(m_IsCentered) - { - typename ImageType::SizeType size= input->GetLargestPossibleRegion().GetSize(); - typename ImageType::SpacingType spacing= input->GetSpacing(); - typename ImageType::PointType origin= input->GetOrigin(); - mCenter.resize(Dim); - for (unsigned int i=0; i IteratorType; - IteratorType it(input, input->GetLargestPossibleRegion()); - it.GoToBegin(); - - typename ImageType::PointType point; - //typename itk::Vector distance; - typename ImageType::IndexType index; - //bool inside; - double distance; - - while (!it.IsAtEnd()) - { - // inside=true; - index=it.GetIndex(); - input->TransformIndexToPhysicalPoint(index, point); - distance=0.0; - for(unsigned int i=0; i(input); -} - -//-------------------------------------------------------------------- - #endif //#define CLITKIMAGEFILLREGIONGENERICFILTER_TXX