X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=filters%2FclitkSplitImageGenericFilter.txx;h=189c4ed584ebc64f919845154176142210b339f3;hb=4934205c18b17f41c1879acbfd70ca2f3b260175;hp=ff7a92eacc35ca2e8dd2fe801afbfd7ef75c9fb8;hpb=931a42358442f4ee4f314613c991c838d4b4e3b7;p=clitk.git diff --git a/filters/clitkSplitImageGenericFilter.txx b/filters/clitkSplitImageGenericFilter.txx index ff7a92e..189c4ed 100644 --- a/filters/clitkSplitImageGenericFilter.txx +++ b/filters/clitkSplitImageGenericFilter.txx @@ -1,101 +1,24 @@ -/*------------------------------------------------------------------------- - - 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 clitkSplitImageGenericFilter_TXX #define clitkSplitImageGenericFilter_TXX - -//This is where you put the actual implementation - #include #include -//-------------------------------------------------------------------- -template -void clitk::SplitImageGenericFilter::UpdateWithDim(std::string PixelType, int Components) { - - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - else if(PixelType == "unsigned_short"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - UpdateWithDimAndPixelType(); - } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - else if (PixelType == "char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - else if (Components==3) - { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and 3D float (DVF)" << std::endl; - UpdateWithDimAndPixelType >(); - } - else std::cerr<<"Number of components is "< -void clitk::SplitImageGenericFilter::UpdateWithDimAndPixelType() { - - // Read input - typedef itk::Image ImageType; - typedef itk::Image OutputImageType; - typename ImageType::Pointer input = clitk::readImage(mInputFilenames[0], mIOVerbose); - typedef itk::ExtractImageFilter FilterType; - typename FilterType::Pointer filter= FilterType::New(); - - filter->SetInput(input); - typename ImageType::SizeType size=input->GetLargestPossibleRegion().GetSize(); - size[mSplitDimension]=0; - typename ImageType::RegionType extracted_region; - extracted_region.SetSize(size); - filter->SetExtractionRegion(extracted_region); - filter->Update(); - - typename ImageType::IndexType index=input->GetLargestPossibleRegion().GetIndex(); - std::string base_filename=GetOutputFilename(); - unsigned int number_of_output_images=input->GetLargestPossibleRegion().GetSize()[mSplitDimension]; - for (unsigned int i=0;iSetExtractionRegion(extracted_region); - filter->Update(); - SetOutputFilename(base_filename+"_"+ss.str()+".mhd"); - typename OutputImageType::Pointer output=filter->GetOutput(); - SetNextOutput(output); - } -} -//-------------------------------------------------------------------- - #endif //#define clitkSplitImageGenericFilter_TXX