segframe.hh
Go to the documentation of this file.
1 /* -*- mia-c++ -*-
2  *
3  * This file is part of MIA - a toolbox for medical image analysis
4  * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
5  *
6  * MIA is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef SegFrame_h
22 #define SegFrame_h
23 
24 #include <vector>
25 #include <mia/2d/segstar.hh>
26 #include <mia/2d/segsection.hh>
27 #include <mia/2d/image.hh>
28 
30 
40 public:
42  typedef std::vector<CSegSection> Sections;
43 
47  typedef std::pair<float, float> Statistics;
48 
50  typedef std::vector<Statistics> SectionsStats;
51 
52 
53  CSegFrame();
54 
61  CSegFrame(const std::string& image, const CSegStar& star, const Sections& sections);
62 
68  CSegFrame(const CXMLElement& node, int version);
69 
71  const std::string& get_imagename() const;
72 
76  void set_imagename(const std::string& name);
77 
82  void rename_base(const std::string& new_base);
83 
85  const Sections& get_sections() const;
86 
91  void set_image(P2DImage image);
92 
96  const CSegStar& get_star() const;
97 
99  const C2DBoundingBox get_boundingbox() const;
100 
101 
107  void write(CXMLElement& node, int version) const;
108 
115  void shift(const C2DFVector& delta, const std::string& cropped_file);
116 
117 
122  void transform(const C2DTransformation& t);
123 
128  void inv_transform(const C2DTransformation& t);
129 
135  float get_hausdorff_distance(const CSegFrame& other) const;
136 
137 
146  C2DUBImage get_section_masks(const C2DBounds& size) const;
147 
152  C2DUBImage get_section_masks() const;
153 
164  C2DUBImage get_section_masks(size_t n_sections) const;
165 
166 
173  SectionsStats get_stats(const C2DUBImage& mask) const;
174 
181  SectionsStats get_stats(size_t n_sections) const;
182 
186  size_t get_nsections() const;
187 
191  float get_quality() const;
192 
196  float get_brightness() const;
197 
201  float get_contrast() const;
202 
203 
208  void set_quality(float q);
209 
214  void set_brightness(float b);
215 
220  void set_contrast(float c);
221 
222 private:
223  void load_image() const;
224 
225  bool m_has_star;
226  CSegStar m_star;
227  Sections m_sections;
228  std::string m_filename;
229  mutable P2DImage m_image;
230 
231  float m_quality;
232  float m_brightness;
233  float m_contrast;
234  int m_version;
235 };
236 
238 
239 #endif
240 
C2DImage::Pointer P2DImage
Shared pointer representation of the 2D Image.
Definition: 2d/image.hh:119
This is the template version of a 2D image that is used for holding real data.
Definition: 2d/image.hh:138
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
#define EXPORT_2D
Definition: defines2d.hh:37
This is the generic base class for 2D transformations.
Definition: 2d/transform.hh:45
std::vector< Statistics > SectionsStats
convenience typedef for the section statistics vector
Definition: segframe.hh:50
Helper class for the segmentation of the left heart ventricle myocardium.
Definition: segstar.hh:38
2D axis orthothogonal bounding box.
Definition: boundingbox.hh:38
This class implements a facade for the xml Element.
Definition: xmlinterface.hh:49
T load_image(const std::string &filename)
Definition: iohandler.hh:192
std::vector< CSegSection > Sections
convenience typedef for the sections
Definition: segframe.hh:42
A class to represent one segmented frame in a heart perfusion series.
Definition: segframe.hh:39
std::pair< float, float > Statistics
Definition: segframe.hh:47
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36