X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkComposeVFGenericFilter.txx;h=5cb6da8bdb956b63d9752bfaa624e23be41b24bd;hb=eee2b74b70c0972894daf6a75685a8ef87e85c8f;hp=343c4ed29b809c5eab37804b3042c00577464d6d;hpb=a26cd8a19e1b9ad8344ab501436045f171a73713;p=clitk.git diff --git a/tools/clitkComposeVFGenericFilter.txx b/tools/clitkComposeVFGenericFilter.txx old mode 100755 new mode 100644 index 343c4ed..5cb6da8 --- a/tools/clitkComposeVFGenericFilter.txx +++ b/tools/clitkComposeVFGenericFilter.txx @@ -3,7 +3,7 @@ Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.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 @@ -14,11 +14,12 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ +===========================================================================**/ #ifndef __clitkComposeVFGenericFilter_txx #define __clitkComposeVFGenericFilter_txx #include "clitkComposeVFGenericFilter.h" +#include "clitkCoeffsToDVF.h" namespace clitk { @@ -36,43 +37,49 @@ namespace clitk } } - + template void ComposeVFGenericFilter::UpdateWithDimAndPixelType() { - - //Define the image type typedef itk::Vector DisplacementType; typedef itk::Image ImageType; + typename ImageType::Pointer input1, input2; - //Read the input1 - typedef itk::ImageFileReader ImageReaderType; - typename ImageReaderType::Pointer reader1= ImageReaderType::New(); - reader1->SetFileName(m_InputName1); - reader1->Update(); - typename ImageType::Pointer input1 =reader1->GetOutput(); - - //Read the input2 - typename ImageReaderType::Pointer reader2= ImageReaderType::New(); - reader2->SetFileName(m_InputName2); - reader2->Update(); - typename ImageType::Pointer input2=reader2->GetOutput(); + //Define the image type + if (m_Type == 1) { + input1 = BLUTCoeffsToDVF(m_InputName1, m_LikeImage, m_Verbose); + input2 = BLUTCoeffsToDVF(m_InputName2, m_LikeImage, m_Verbose); + } + else { + //Read the input1 + typedef itk::ImageFileReader ImageReaderType; + typename ImageReaderType::Pointer reader1= ImageReaderType::New(); + reader1->SetFileName(m_InputName1); + reader1->Update(); + input1 =reader1->GetOutput(); - //Create the ComposeVFFilter - typedef clitk::ComposeVFFilter FilterType; - typename FilterType::Pointer filter =FilterType::New(); - filter->SetInput1(input1); - filter->SetInput2(input2); - filter->SetVerbose(m_Verbose); - filter->Update(); - - //Write the output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_OutputName); - writer->SetInput(filter->GetOutput()); - writer->Update(); + //Read the input2 + typename ImageReaderType::Pointer reader2= ImageReaderType::New(); + reader2->SetFileName(m_InputName2); + reader2->Update(); + input2=reader2->GetOutput(); + } + + //Create the ComposeVFFilter + typedef clitk::ComposeVFFilter FilterType; + typename FilterType::Pointer filter =FilterType::New(); + filter->SetInput1(input1); + filter->SetInput2(input2); + filter->SetVerbose(m_Verbose); + filter->Update(); + //Write the output + typedef itk::ImageFileWriter WriterType; + typename WriterType::Pointer writer = WriterType::New(); + writer->SetFileName(m_OutputName); + writer->SetInput(filter->GetOutput()); + writer->Update(); + } }