/*========================================================================= 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://www.centreleonberard.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 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 clitkFillImageRegionGenericFilter_txx #define clitkFillImageRegionGenericFilter_txx /* ================================================= * @file clitkFillImageRegionGenericFilter.txx * @author * @date * * @brief * ===================================================*/ namespace clitk { //------------------------------------------------------------------- // Update with the number of dimensions //------------------------------------------------------------------- template void FillImageRegionGenericFilter::UpdateWithDim(std::string PixelType) { 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(); } } //------------------------------------------------------------------- // Update with the number of dimensions and the pixeltype //------------------------------------------------------------------- template void FillImageRegionGenericFilter::UpdateWithDimAndPixelType() { // ImageTypes typedef itk::Image InputImageType; typedef itk::Image OutputImageType; // Read the input typedef itk::ImageFileReader InputReaderType; typename InputReaderType::Pointer reader = InputReaderType::New(); reader->SetFileName( m_InputFileName); reader->Update(); typename InputImageType::Pointer input= reader->GetOutput(); // Processing switch(m_ArgsInfo.shape_arg) { //rectangular case 0: { // Get Size and index of the region typename InputImageType::SizeType size; if (m_ArgsInfo.size_given) for(unsigned int i=0; i IteratorType; IteratorType it(input, region); it.GoToBegin(); while (!it.IsAtEnd()) { it.Set(m_ArgsInfo.value_arg); ++it; } break; } //ellipsoide case 1: { //Get the center typename InputImageType::PointType center; if (m_ArgsInfo.center_given) for(unsigned int i=0; iGetLargestPossibleRegion().GetSize(); typename InputImageType::SpacingType spacing= input->GetSpacing(); typename InputImageType::PointType origin= input->GetOrigin(); for (unsigned int i=0; i offset; for (unsigned int i=0; i axes; if (m_ArgsInfo.axes_given) for(unsigned int i=0; i IteratorType; IteratorType it(input, input->GetLargestPossibleRegion()); it.GoToBegin(); typename InputImageType::PointType point; typename InputImageType::IndexType index; double distance; while (!it.IsAtEnd()) { index=it.GetIndex(); input->TransformIndexToPhysicalPoint(index, point); distance=0.0; for(unsigned int i=0; i WriterType; typename WriterType::Pointer writer = WriterType::New(); writer->SetFileName(m_ArgsInfo.output_arg); writer->SetInput(input); writer->Update(); } }//end clitk #endif //#define clitkFillImageRegionGenericFilter_txx