SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkMRSAutoPhase.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2009-2014 The Regents of the University of California.
3  * All Rights Reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * • Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  * • Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12  * • None of the names of any campus of the University of California, the name
13  * "The Regents of the University of California," or the names of any of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
26  * OF SUCH DAMAGE.
27  */
28 
29 
30 
31 /*
32  * $URL$
33  * $Rev$
34  * $Author$
35  * $Date$
36  *
37  * Authors:
38  * Jason C. Crane, Ph.D.
39  * Beck Olson
40  */
41 
42 
43 #ifndef SVK_MRS_AUTO_PHASE_H
44 #define SVK_MRS_AUTO_PHASE_H
45 
46 #define SWARM
47 
48 #include <itkPowellOptimizer.h>
49 #include <itkParticleSwarmOptimizer.h>
50 
51 #include <vtkObject.h>
52 #include <vtkObjectFactory.h>
53 #include <vtkInformation.h>
54 
55 #include <svkImageData.h>
56 #include <svkMrsImageData.h>
57 #include <vtkStreamingDemandDrivenPipeline.h>
59 
60 #include <complex>
61 #include <svkDcmHeader.h>
62 
63 #include <math.h>
64 #include <stdio.h>
65 #include <string.h>
66 
67 
68 namespace svk {
69 
70 
71 using namespace std;
72 
73 
78 {
79 
80  public:
81 
83  //static svkMRSAutoPhase* New();
84 
85 
86  // _0 are zero order models
87  // MAX_PEAK_HTS_0 maximizes the peak height of a specified peak
88  // _1 are first order models
89  typedef enum {
90  UNDEFINED_PHASE_MODEL = 0,
91  FIRST_POINT_0 = 1,
92  MAX_PEAK_HTS_0 = 2,
93  MAX_PEAK_HT_ONE_PEAK_0 = 3,
94  //MAX_GLOBAL_PEAK_HT_0,
95  //MIN_DIFF_FROM_MAG_0,
96  //MAX_PEAK_HT_0_ONE_PEAK,
97  //MIN_DIFF_FROM_MAG_0_ONE_PEAK,
98  //LAST_ZERO_ORDER_MODEL,
99  //MAX_PEAK_HTS_1,
100  //MIN_DIFF_FROM_MAG_1,
101  //MAX_PEAK_HTS_01,
102  LAST_MODEL
103  } PhasingModel;
104 
105  //void SetPhasingModel(svkMRSAutoPhase::phasingModel model);
106  void OnlyUseSelectionBox();
107 
108  virtual svkImageData* GetOutput(int port);
109 
110 
111 
112  protected:
113 
114  svkMRSAutoPhase();
115  ~svkMRSAutoPhase();
116 
117  virtual int RequestInformation(
118  vtkInformation* request,
119  vtkInformationVector** inputVector,
120  vtkInformationVector* outputVector
121  );
122 
123  virtual int RequestData(
124  vtkInformation* request,
125  vtkInformationVector** inputVector,
126  vtkInformationVector* outputVector
127  );
128 
129  int SVKRequestDataPreExec(
130  vtkInformation* request,
131  vtkInformationVector** inputVector,
132  vtkInformationVector* outputVector
133  );
134  int SVKRequestDataPostExec(
135  vtkInformation* request,
136  vtkInformationVector** inputVector,
137  vtkInformationVector* outputVector
138  );
139 
140  virtual void ThreadedRequestData(
141  vtkInformation* request,
142  vtkInformationVector** inputVector,
143  vtkInformationVector* outputVector,
144  vtkImageData*** inData,
145  vtkImageData** outData,
146  int extent[6],
147  int threadId
148  );
149 
150  virtual void ValidateInput();
151 
152 
153  virtual int FillInputPortInformation( int vtkNotUsed(port), vtkInformation* info );
154  virtual int FillOutputPortInformation( int vtkNotUsed(port), vtkInformation* info );
155 
156  void ZeroData();
157  virtual void UpdateProvenance();
158 
159  void AutoPhaseExecute(int* outExt, int id);
160  virtual void AutoPhaseSpectrum( int cellID );
161  virtual void FitPhase( int cellID ) = 0;
162  virtual void PrePhaseSetup() = 0;
163  virtual void PostPhaseCleanup() = 0;
164  void SyncPointsFromCells();
165  virtual void SetMapSeriesDescription( );
166 
167 
168  static int* progress;
169 
170 
171 #ifdef SWARM
172  virtual void InitOptimizer( int cellID, itk::ParticleSwarmOptimizer::Pointer itkOptimizer ) = 0;
173 #else
174  virtual void InitOptimizer( int cellID, itk::PowellOptimizer::Pointer itkOptimizer ) = 0;
175 #endif
176 
183  vtkDataArray* mapArrayZeroOrderPhase;
184 
185 };
186 
187 
188 } //svk
189 
190 
191 #endif //SVK_MRS_AUTO_PHASE_H
192 
string seriesDescription
Definition: svkMRSAutoPhase.h:182
Definition: svkMRSAutoPhase.h:77
bool isSpectralFFTRequired
Definition: svkMRSAutoPhase.h:181
bool onlyUseSelectionBox
Definition: svkMRSAutoPhase.h:179
Definition: svkThreadedImageAlgorithm.h:71
short * selectionBoxMask
Definition: svkMRSAutoPhase.h:180
vtkDataArray * mapArrayZeroOrderPhase
Definition: svkMRSAutoPhase.h:183
static int * progress
Definition: svkMRSAutoPhase.h:168
Definition: svkImageData.h:107
PhasingModel
Definition: svkMRSAutoPhase.h:89
int numTimePoints
Definition: svkMRSAutoPhase.h:177
svkMRSAutoPhase::PhasingModel phaseModelType
Definition: svkMRSAutoPhase.h:178