File: InputSelectionImageFilter.cxx

package info (click to toggle)
itksnap 3.6.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 22,132 kB
  • sloc: cpp: 91,089; ansic: 1,994; sh: 327; makefile: 16
file content (61 lines) | stat: -rw-r--r-- 1,570 bytes parent folder | download | duplicates (3)
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
#include "InputSelectionImageFilter.h"
#include "itkUnaryFunctorImageFilter.hxx"
#include "IRISException.h"

#include "itkAddImageFilter.h"

template<class TInputImage, typename TTag>
InputSelectionImageFilter<TInputImage,TTag>
::InputSelectionImageFilter()
{
}

template<class TInputImage, typename TTag>
void
InputSelectionImageFilter<TInputImage,TTag>
::AddSelectableInput(TagType tag, InputImageType *input)
{
  m_TagMap[tag] = input;
  if(m_TagMap.size() == 0)
    SetSelectedInput(tag);
}

template<class TInputImage, typename TTag>
void
InputSelectionImageFilter<TInputImage,TTag>
::RemoveAllSelectableInputs()
{
  m_TagMap.clear();
  this->SetInput(NULL);
}

template<class TInputImage, typename TTag>
void
InputSelectionImageFilter<TInputImage,TTag>
::SetSelectedInput(TagType &tag)
{
  this->SetInput(m_TagMap[tag]);
  m_SelectedInput = tag;
  this->Modified();
}

/**
 * Adopted from itk::InPlaceImageFilter::InternalAllocateOutputs()
 */
template<class TInputImage, typename TTag>
void
InputSelectionImageFilter<TInputImage,TTag>
::GenerateData()
{
  // Just pass the container to the output image
  InputImageType *inputPtr = const_cast<InputImageType *>(this->GetInput());
  OutputImageType *outputPtr = this->GetOutput();

  outputPtr->CopyInformation(inputPtr);
  outputPtr->SetBufferedRegion(inputPtr->GetBufferedRegion());
  outputPtr->SetPixelContainer(inputPtr->GetPixelContainer());
}

#include "DisplayMappingPolicy.h"
#include "itkRGBAPixel.h"
template class InputSelectionImageFilter<ImageWrapperBase::DisplaySliceType, MultiChannelDisplayMode>;