Tomato
itkSortInvTimesImageFilter.h
1 //
2 // itkOxSortInvTimesImageFilter
3 // TomatoLib
4 //
5 // Created by Konrad Werys on 5/6/17.
6 // Copyright © 2017 Konrad Werys. All rights reserved.
7 //
8 
9 #ifndef TomatoLIB_ITKOXSORTINVTIMESIMAGEFILTER_H
10 #define TomatoLIB_ITKOXSORTINVTIMESIMAGEFILTER_H
11 
12 #include "tomatolib_export.h"
13 #include "CmakeConfigForTomato.h"
14 #ifdef USE_ITK
15 
16 #include <vnl/vnl_index_sort.h>
17 
18 #include "itkImageToImageFilter.h"
19 #include "itkImageLinearIteratorWithIndex.h"
20 
21 namespace itk {
22  template<typename TImageIn, typename TImageOut>
23  class SortInvTimesImageFilter : public ImageToImageFilter<TImageIn, TImageOut> {
24  public:
26  typedef SortInvTimesImageFilter Self;
27  typedef ImageToImageFilter<TImageIn, TImageOut> Superclass;
28  typedef SmartPointer<Self> Pointer;
29 
31  itkNewMacro(Self);
32 
34  itkTypeMacro(OxSortInvTimesImageFilter, ImageToImageFilter);
35 
36  typedef typename TImageIn::PixelType PixelTypeIn;
37  typedef typename TImageOut::PixelType PixelTypeOut;
38 
39  void SortIndices(vnl_vector<PixelTypeIn> vector);
40 
41  void SortByInvTimes();
42  void SortByEchoTimes();
43  void SortByRepTimes();
44  void SortByTriggerTimes();
45  void SortByAcqTimes();
46  void SortByRelAcqTimes();
47 
48  itkSetMacro( InvTimesNonSorted, vnl_vector<PixelTypeIn> );
49  itkGetMacro( InvTimesNonSorted, vnl_vector<PixelTypeIn> );
50  itkGetMacro( InvTimesSorted, vnl_vector<PixelTypeIn> );
51 
52  itkSetMacro( EchoTimesNonSorted, vnl_vector<PixelTypeIn> );
53  itkGetMacro( EchoTimesNonSorted, vnl_vector<PixelTypeIn> );
54  itkGetMacro( EchoTimesSorted, vnl_vector<PixelTypeIn> );
55 
56  itkSetMacro( RepTimesNonSorted, vnl_vector<PixelTypeIn> );
57  itkGetMacro( RepTimesNonSorted, vnl_vector<PixelTypeIn> );
58  itkGetMacro( RepTimesSorted, vnl_vector<PixelTypeIn> );
59 
60  itkSetMacro( TriggerTimesNonSorted, vnl_vector<PixelTypeIn> );
61  itkGetMacro( TriggerTimesNonSorted, vnl_vector<PixelTypeIn> );
62  itkGetMacro( TriggerTimesSorted, vnl_vector<PixelTypeIn> );
63 
64  itkSetMacro( AcqTimesNonSorted, vnl_vector<PixelTypeIn> );
65  itkGetMacro( AcqTimesNonSorted, vnl_vector<PixelTypeIn> );
66  itkGetMacro( AcqTimesSorted, vnl_vector<PixelTypeIn> );
67 
68  itkSetMacro( RelAcqTimesNonSorted, vnl_vector<PixelTypeIn> );
69  itkGetMacro( RelAcqTimesNonSorted, vnl_vector<PixelTypeIn> );
70  itkGetMacro( RelAcqTimesSorted, vnl_vector<PixelTypeIn> );
71 
72  itkGetMacro( Indices, vnl_vector<int> );
73 
74  protected:
76  SortInvTimesImageFilter() {
77  m_nSamples = 0;
78  };
79 
81  ~SortInvTimesImageFilter() {};
82 
84  virtual void GenerateData() ITK_OVERRIDE;
85  private:
86  ITK_DISALLOW_COPY_AND_ASSIGN(SortInvTimesImageFilter); //purposely not implemented
87 
88  vnl_vector<typename TImageIn::PixelType> m_InvTimesNonSorted;
89  vnl_vector<typename TImageIn::PixelType> m_InvTimesSorted;
90  vnl_vector<typename TImageIn::PixelType> m_EchoTimesNonSorted;
91  vnl_vector<typename TImageIn::PixelType> m_EchoTimesSorted;
92  vnl_vector<typename TImageIn::PixelType> m_RepTimesNonSorted;
93  vnl_vector<typename TImageIn::PixelType> m_RepTimesSorted;
94  vnl_vector<typename TImageIn::PixelType> m_TriggerTimesNonSorted;
95  vnl_vector<typename TImageIn::PixelType> m_TriggerTimesSorted;
96  vnl_vector<typename TImageIn::PixelType> m_AcqTimesNonSorted;
97  vnl_vector<typename TImageIn::PixelType> m_AcqTimesSorted;
98  vnl_vector<typename TImageIn::PixelType> m_RelAcqTimesNonSorted;
99  vnl_vector<typename TImageIn::PixelType> m_RelAcqTimesSorted;
100  vnl_vector<int> m_Indices;
101  size_t m_nSamples;
102  };
103 
104 } //namespace ITK
105 
106 #ifndef TOMATOLIB_COMPILED
107 #ifndef ITK_MANUAL_INSTANTIATION
108 #include "itkSortInvTimesImageFilter.txx"
109 #endif //ITK_MANUAL_INSTANTIATION
110 #endif //TOMATOLIB_COMPILED
111 
112 #endif //USE_ITK
113 
114 #endif //TomatoLIB_ITKOXSORTINVTIMESIMAGEFILTER_H
Definition: itkImageFileReaderKW.h:31