X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=filters%2FclitkImageFillRegionGenericFilter.txx;h=817ef8f3660aea593151a07f57ae8269495c616c;hb=711d2abc875d5e997b5cdbf762ca5c7c67df6719;hp=4d81f0e8b947408b220b48c886dcef5284103951;hpb=931a42358442f4ee4f314613c991c838d4b4e3b7;p=clitk.git diff --git a/filters/clitkImageFillRegionGenericFilter.txx b/filters/clitkImageFillRegionGenericFilter.txx index 4d81f0e..817ef8f 100644 --- a/filters/clitkImageFillRegionGenericFilter.txx +++ b/filters/clitkImageFillRegionGenericFilter.txx @@ -1,15 +1,20 @@ -/*------------------------------------------------------------------------- - - Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de - l'Image). All rights reserved. See Doc/License.txt or - http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. - +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - - -------------------------------------------------------------------------*/ + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +======================================================================-====*/ #ifndef CLITKIMAGEFILLREGIONGENERICFILTER_TXX #define CLITKIMAGEFILLREGIONGENERICFILTER_TXX @@ -17,130 +22,7 @@ * @file clitkImageFillRegionGenericFilter.txx * @author Cristina Gimenez * @date 9 August 2006 - * + * -------------------------------------------------*/ -//-------------------------------------------------------------------- -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