X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkComposeVFGenericFilter.txx;h=0e6d1a47e2ad187e16f09379fc43cac4dd602d79;hb=refs%2Fheads%2FextentSimon;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..0e6d1a4 --- 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 "clitkConvertBLUTCoeffsToVFFilter.h" namespace clitk { @@ -36,43 +37,58 @@ namespace clitk } } - + template void ComposeVFGenericFilter::UpdateWithDimAndPixelType() { - - //Define the image type typedef itk::Vector DisplacementType; typedef itk::Image ImageType; + typename ImageType::Pointer input1, input2; + + //Define the image type + if (m_Type == 1) { + typedef ConvertBLUTCoeffsToVFFilter VFFilterType; + typename VFFilterType::Pointer vf_filter = VFFilterType::New(); + vf_filter->SetInputFileName(m_InputName1); + vf_filter->SetLikeFileName(m_LikeImage); + vf_filter->SetVerbose(m_Verbose); + vf_filter->Update(); + input1 = vf_filter->GetOutput(); - //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(); + vf_filter->SetInputFileName(m_InputName2); + vf_filter->Update(); + input2 = vf_filter->GetOutput(); + } + 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(); + } }