1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
/*=========================================================================
Program: Advanced Normalization Tools
Copyright (c) ConsortiumOfANTS. All rights reserved.
See accompanying COPYING.txt or
https://github.com/stnava/ANTs/blob/master/ANTSCopyright.txt
for details.
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.
=========================================================================*/
#ifndef _itkListSampleToListSampleFilter_hxx
#define _itkListSampleToListSampleFilter_hxx
namespace itk
{
namespace ants
{
namespace Statistics
{
/**
*
*/
template <typename TInputListSample, typename TOutputListSample>
ListSampleToListSampleFilter<TInputListSample, TOutputListSample>::ListSampleToListSampleFilter()
{
// Modify superclass default values, can be overridden by subclasses
this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredOutputs(1);
}
template <typename TInputListSample, typename TOutputListSample>
void
ListSampleToListSampleFilter<TInputListSample, TOutputListSample>::SetInputListSample(const TInputListSample * input)
{
// this->m_InputListSample = const_cast<InputListSampleType *>( input );
this->ProcessObject::SetNthInput(0, reinterpret_cast<DataObject *>(const_cast<InputListSampleType *>(input)));
}
template <typename TInputListSample, typename TOutputListSample>
void
ListSampleToListSampleFilter<TInputListSample, TOutputListSample>::AllocateOutput()
{
typename DataObject::Pointer obj = reinterpret_cast<DataObject *>(TOutputListSample::New().GetPointer());
// typename TOutputListSample::Pointer output
// = reinterpret_cast<TOutputListSample*>(obj.GetPointer());
this->ProcessObject::SetNumberOfRequiredOutputs(1);
this->ProcessObject::SetNthOutput(0, obj.GetPointer());
// this->m_OutputListSample = OutputListSampleType::New();
}
/**
*
*/
template <typename TInputListSample, typename TOutputListSample>
typename ListSampleToListSampleFilter<TInputListSample, TOutputListSample>::InputListSampleType *
ListSampleToListSampleFilter<TInputListSample, TOutputListSample>::GetInput()
{
return reinterpret_cast<TInputListSample *>(this->ProcessObject::GetInput(0));
}
template <typename TInputListSample, typename TOutputListSample>
typename ListSampleToListSampleFilter<TInputListSample, TOutputListSample>::OutputListSampleType *
ListSampleToListSampleFilter<TInputListSample, TOutputListSample>::GetOutput()
{
if (this->GetNumberOfOutputs() < 1)
{
return nullptr;
}
// we assume that the first output is of the templated type
return reinterpret_cast<TOutputListSample *>(this->ProcessObject::GetOutput(0));
// return this->m_OutputListSample.GetPointer();
}
} // end of namespace Statistics
} // end of namespace ants
} // end of namespace itk
#endif
|