X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkComposeVFGenericFilter.txx;h=0e6d1a47e2ad187e16f09379fc43cac4dd602d79;hb=refs%2Fheads%2FextentSimon;hp=80d1d001a9bdf172a8df55a572ed7c4fb8e770e7;hpb=08d1fd56ac1d08bd228d9e557f5472a395e9b708;p=clitk.git diff --git a/tools/clitkComposeVFGenericFilter.txx b/tools/clitkComposeVFGenericFilter.txx index 80d1d00..0e6d1a4 100644 --- a/tools/clitkComposeVFGenericFilter.txx +++ b/tools/clitkComposeVFGenericFilter.txx @@ -19,6 +19,7 @@ #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(); + } }