SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkImageStatistics.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_IMAGE_STATISTICS_H
44 #define SVK_IMAGE_STATISTICS_H
45 #define DOUBLE_TO_STRING_PRECISION 14
46 
47 
48 #include <stdio.h>
49 #include <map>
50 #include <vtkObjectFactory.h>
51 #include <vtkObject.h>
52 #include <vtkXMLDataElement.h>
53 #include <svkImageReaderFactory.h>
54 #include <svkImageReader2.h>
55 #include <svkMriImageData.h>
56 #include <vtkOrderStatistics.h>
59 #include <svkIdfVolumeWriter.h>
61 #include <vtkImageToImageStencil.h>
62 #include <vtkXMLUtilities.h>
63 #include <svkXML.h>
64 #include <vtkArrayToTable.h>
65 #include <vtkTable.h>
66 #include <vtkDescriptiveStatistics.h>
67 #include <svkDataValidator.h>
68 #include <vtkSortDataArray.h>
69 #include <vtkVariant.h>
70 #include <svkXMLUtils.h>
71 
72 namespace svk {
73 
74 
75 using namespace std;
76 
86 {
87 
88  public:
89 
90  typedef enum {
91  INPUT_IMAGE = 0,
119  OUTPUT_FILE_NAME
120  } svkImageStatisticsParameter;
121 
122  typedef enum {
123  NONE = 0,
125  MEAN
126  } svkNormalizationOptions;
127 
128  // vtk type revision macro
130 
131  // vtk initialization
132  static svkImageStatistics* New();
133 
135  vtkXMLDataElement* GetOutput( );
136 
137  protected:
138 
141 
143  virtual int RequestData(
144  vtkInformation* request,
145  vtkInformationVector** inputVector,
146  vtkInformationVector* outputVector );
147 
148  void ComputeAccumulateStatistics(svkMriImageData* image, svkMriImageData* roi, double binSize, vtkDataArray* maskedPixels, vtkXMLDataElement* result, double normalization = 0 );
149  void ComputeOrderStatistics(svkMriImageData* image, svkMriImageData* roi, vtkDataArray* maskedPixels, vtkXMLDataElement* result);
150  void ComputeDescriptiveStatistics(svkMriImageData* image, svkMriImageData* roi, vtkDataArray* maskedPixels, vtkXMLDataElement* result );
151  void ComputeSmoothStatistics(svkMriImageData* image, svkMriImageData* roi, double binSize, vtkDataArray* maskedPixel, vtkXMLDataElement* results, double normalization = 0 );
152  void AddHistogramTag( vtkDataArray* histogram, double binSize, double startBin, int numBins, int smoothBins, vtkXMLDataElement* results);
153 
154  private:
155 
156  bool GetShouldCompute( svkImageStatistics::svkImageStatisticsParameter parameter);
157  string DoubleToString( double value );
158 
159 };
160 
161 
162 } //svk
163 
164 #endif //SVK_IMAGE_STATISTICS_H
Definition: svkImageStatistics.h:103
Definition: svkImageStatistics.h:101
Definition: svkImageStatistics.h:97
Definition: svkImageStatistics.h:94
Definition: svkImageStatistics.h:104
Definition: svkImageStatistics.h:105
Definition: svkImageStatistics.h:96
Definition: svkImageStatistics.h:113
Definition: svkImageStatistics.h:117
Definition: svkImageStatistics.h:100
svkImageStatisticsParameter
Definition: svkImageStatistics.h:90
Definition: svkImageStatistics.h:115
Definition: svkImageStatistics.h:92
Definition: svkImageStatistics.h:118
Definition: svkImageStatistics.h:93
Definition: svkImageStatistics.h:114
Definition: svkImageStatistics.h:124
Definition: svkImageStatistics.h:111
Definition: svkImageStatistics.h:85
Definition: svkImageStatistics.h:116
Definition: svkImageStatistics.h:112
Definition: svkGenericAlgorithmWithPortMapper.h:74
Definition: svkImageStatistics.h:95
Definition: svkImageStatistics.h:106
Definition: svkImageStatistics.h:108
Definition: svkImageStatistics.h:110
Definition: svkImageStatistics.h:98
Definition: svkImageStatistics.h:107
Definition: svkImageStatistics.h:102
Definition: svkMriImageData.h:72
Definition: svkImageStatistics.h:109
Definition: svkImageStatistics.h:99