rasdaman complete source
rviewOSection.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
23 
39 #ifndef _RVIEW_OSECTION_H_
40 #define _RVIEW_OSECTION_H_
41 
42 #include "rviewDModes.hh"
43 
44 
45 /*
46  * Abstract base class for orthosection views of 3D image volumes
47  * Client classes implement the data sources (everything in memory
48  * vs. loading slices on demand)
49  */
50 
52 {
53 public:
54 
55  rviewOSectionImage(mdd_frame *mf, unsigned int flags=0);
56  virtual ~rviewOSectionImage(void);
57 
58  virtual void label(void);
59  virtual int process(wxObject &obj, wxEvent &evt);
60  virtual void OnSize(int w, int h);
61  virtual int openViewer(void);
62 
63  virtual const char *getFrameName(void) const;
64  virtual rviewFrameType getFrameType(void) const;
65  virtual int getViewerType(void) const;
66  virtual void childMouseEvent(wxWindow *child, wxMouseEvent &mev);
67 
68  // new virtual methods
69  virtual bool sectionValid(unsigned int num) = 0;
70  virtual const r_Minterval &getSectionDomain(unsigned int num) = 0;
71  virtual const r_Minterval &getSectionParent(unsigned int num) = 0;
72  virtual char *getSectionArray(unsigned int num) = 0;
73  virtual long getSectionProjection(unsigned int num) = 0;
74  virtual r_Ref<r_GMarray> &getCsmapArray(void) = 0;
75 
76  // internal structures
77  struct section_map_s;
78  struct section_part_s;
79  typedef struct section_map_s section_map_t;
80  typedef struct section_part_s section_part_t;
81 
82  // constants
83  // additional height of control panel
84  static const int osection_ctrly;
85  // width of righthand column (next to sliders)
86  static const int osection_rcwidth;
87  // height of slider bar
88  static const int osection_sheight;
89  // Checkbox dimensions
90  static const int osection_chkwidth;
91  static const int osection_chkheight;
92  // Text widget dimensions
93  static const int osection_twidth;
94  static const int osection_theight;
95  // Button dimensions
96  static const int osection_bwidth;
97  static const int osection_bheight;
98 
99 
100 protected:
101 
102  virtual char *initMode(void);
103  virtual char *setupEnvironment(int w, int h);
104  virtual bool doUpdate(int updateFlags);
105  virtual void fillBuffer(void);
106 
107  // view management
108  virtual int saveView(FILE *fp);
109  virtual int readView(const char *key, const char *value);
110  virtual void loadViewFinished(void);
111 
112  // create the currently relevant spatial domain for a slice
113  int makeMinterval(unsigned int num, r_Minterval &dom);
114  // partition sections into quadrants for rendering
115  int performPartition(void);
116  // update a slice
117  void updateSlice(unsigned int num, long value, bool useDummy=TRUE);
118  // refresh all slices that need to (or all, if force=TRUE)
119  void refreshSlices(bool force=FALSE);
120 
121  // load the correct slices from the database if necessary
122  virtual int ensureSections(void) = 0;
123  // create a dummy slice (empty)
124  virtual int createDummySection(unsigned int num, const r_Minterval *dom=NULL) = 0;
125  // flush out all slices
126  virtual void flushSlices(void) = 0;
127 
128  void setOId(const r_OId &oid);
129 
130  //rviewSlider **sliders;
135 
136  // intersection point of the (3) sections
138  // thickness of a section (1)
140  // mapping sections to dimensions
141  struct section_map_s *secmap;
142  // mapping partitions (section quadrants) to sections and 3D space
143  struct section_part_s *partition;
144  unsigned int numPartitions;
146  // currently selected section
147  unsigned int currentSection;
148  // static members
149  static const unsigned int numSections;
150  static const char *sliderLabels[];
151 
152  // view parameters
153  static const char *view_Thickness;
154  static const char *view_MidPoint;
155  static const char *view_UseBBox;
156 };
157 
158 
159 
160 
161 /*
162  * Orthosection class where slices are loaded on demand from the database.
163  */
164 
166 {
167 public:
168  rviewOSectionPartImage(mdd_frame *mf, const char *cname, const r_OId &oid, unsigned int flags=0);
170 
171  virtual void label(void);
172  virtual int process(wxObject &obj, wxEvent &evt);
173  virtual void OnSize(int w, int h);
174  virtual void childMouseEvent(wxWindow *child, wxMouseEvent &mev);
175 
176  virtual bool sectionValid(unsigned int num);
177  virtual const r_Minterval &getSectionDomain(unsigned int num);
178  virtual const r_Minterval &getSectionParent(unsigned int num);
179  virtual char *getSectionArray(unsigned int num);
180  virtual long getSectionProjection(unsigned int num);
181  virtual r_Ref<r_GMarray> &getCsmapArray(void);
182 
183  // create a new instance.
184  static rviewOSectionPartImage *createViewer(const char *collname, const double *loid=NULL);
185 
186  struct section_desc_s;
187  typedef struct section_desc_s section_desc_t;
188 
189 
190 protected:
191  virtual int ensureSections(void);
192  virtual int createDummySection(unsigned int num, const r_Minterval *dom=NULL);
193  virtual void flushSlices(void);
194 
197 
198  // the sections (slices through the cube; all technically 3D)
199  struct section_desc_s *sections;
202  // dummy MDD used for colourspace configuration
204 };
205 
206 
207 
208 
209 
210 /*
211  * Orthosection class where the entire object is in client memory
212  */
213 
215 {
216 public:
217  rviewOSectionFullImage(mdd_frame *mf, unsigned int flags = 0);
219 
220  virtual bool sectionValid(unsigned int num);
221  virtual const r_Minterval &getSectionDomain(unsigned int num);
222  virtual const r_Minterval &getSectionParent(unsigned int num);
223  virtual char *getSectionArray(unsigned int num);
224  virtual long getSectionProjection(unsigned int num);
225  virtual r_Ref<r_GMarray> &getCsmapArray(void);
226 
227 
228 protected:
229  virtual int ensureSections(void);
230  virtual int createDummySection(unsigned int num, const r_Minterval *dom=NULL);
231  virtual void flushSlices(void);
232 
234 };
235 
236 #endif
static const int osection_chkwidth
Definition: rviewOSection.hh:90
virtual const char * getFrameName(void) const
struct section_part_s section_part_t
Definition: rviewOSection.hh:80
static const char * sliderLabels[]
Definition: rviewOSection.hh:150
virtual r_Ref< r_GMarray > & getCsmapArray(void)=0
virtual ~rviewOSectionImage(void)
virtual void label(void)
struct section_desc_s * sections
Definition: rviewOSection.hh:199
virtual void label(void)
virtual char * setupEnvironment(int w, int h)
virtual int process(wxObject &obj, wxEvent &evt)
virtual r_Ref< r_GMarray > & getCsmapArray(void)
virtual void childMouseEvent(wxWindow *child, wxMouseEvent &mev)
Definition: point.hh:59
rviewCheckBox * fireDragRelease
Definition: rviewOSection.hh:195
virtual const r_Minterval & getSectionParent(unsigned int num)
virtual bool doUpdate(int updateFlags)
virtual void fillBuffer(void)
static const int osection_bwidth
Definition: rviewOSection.hh:96
virtual const r_Minterval & getSectionParent(unsigned int num)
Definition: rviewOSection.hh:214
static const char * view_MidPoint
Definition: rviewOSection.hh:154
static const int osection_bheight
Definition: rviewOSection.hh:97
DynamicString collName
Definition: rviewOSection.hh:201
virtual int getViewerType(void) const
virtual int ensureSections(void)=0
static const int osection_ctrly
Definition: rviewOSection.hh:84
unsigned int numPartitions
Definition: rviewOSection.hh:144
rviewSpecialSlider ** sliders
Definition: rviewOSection.hh:131
virtual void flushSlices(void)=0
static const int osection_twidth
Definition: rviewOSection.hh:93
Definition: rviewDModes.hh:526
#define FALSE
Definition: defs.h:70
r_Ref< r_GMarray > csDummy
Definition: rviewOSection.hh:203
virtual r_Ref< r_GMarray > & getCsmapArray(void)
virtual int ensureSections(void)
virtual char * initMode(void)
Definition: rviewUtils.hh:636
rviewOSectionFullImage(mdd_frame *mf, unsigned int flags=0)
static const int osection_theight
Definition: rviewOSection.hh:94
virtual int createDummySection(unsigned int num, const r_Minterval *dom=NULL)=0
Definition: rviewUtils.hh:717
rviewCheckBox * boundingBox
Definition: rviewOSection.hh:133
virtual long getSectionProjection(unsigned int num)
int performPartition(void)
virtual long getSectionProjection(unsigned int num)=0
virtual rviewFrameType getFrameType(void) const
virtual const r_Minterval & getSectionParent(unsigned int num)=0
virtual void loadViewFinished(void)
virtual int ensureSections(void)
rviewButton * fireButton
Definition: rviewOSection.hh:196
virtual bool sectionValid(unsigned int num)
rviewText ** sltexts
Definition: rviewOSection.hh:132
virtual void childMouseEvent(wxWindow *child, wxMouseEvent &mev)
struct section_map_s * secmap
Definition: rviewOSection.hh:141
virtual bool sectionValid(unsigned int num)=0
virtual int saveView(FILE *fp)
static const unsigned int numSections
Definition: rviewOSection.hh:149
rviewOSectionPartImage(mdd_frame *mf, const char *cname, const r_OId &oid, unsigned int flags=0)
virtual void flushSlices(void)
rviewFrameType
Definition: rviewUtils.hh:443
r_Minterval * sections
Definition: rviewOSection.hh:233
static const int osection_chkheight
Definition: rviewOSection.hh:91
virtual int openViewer(void)
int thickness
Definition: rviewOSection.hh:139
Definition: rviewOSection.hh:165
static const char * view_Thickness
Definition: rviewOSection.hh:153
void updateSlice(unsigned int num, long value, bool useDummy=TRUE)
static rviewOSectionPartImage * createViewer(const char *collname, const double *loid=NULL)
virtual void flushSlices(void)
virtual int readView(const char *key, const char *value)
unsigned int currentSection
Definition: rviewOSection.hh:147
Definition: rviewUtils.hh:386
virtual int createDummySection(unsigned int num, const r_Minterval *dom=NULL)
bool doBoundingBox
Definition: rviewOSection.hh:145
virtual char * getSectionArray(unsigned int num)
virtual void OnSize(int w, int h)
virtual int createDummySection(unsigned int num, const r_Minterval *dom=NULL)
virtual const r_Minterval & getSectionDomain(unsigned int num)=0
rviewText * thickText
Definition: rviewOSection.hh:134
static const char * view_UseBBox
Definition: rviewOSection.hh:155
int makeMinterval(unsigned int num, r_Minterval &dom)
virtual char * getSectionArray(unsigned int num)=0
virtual char * getSectionArray(unsigned int num)
struct section_map_s section_map_t
Definition: rviewOSection.hh:79
r_OId objOId
Definition: rviewOSection.hh:200
static const int osection_rcwidth
Definition: rviewOSection.hh:86
virtual const r_Minterval & getSectionDomain(unsigned int num)
virtual const r_Minterval & getSectionDomain(unsigned int num)
Definition: rviewUtils.hh:663
virtual int process(wxObject &obj, wxEvent &evt)
Definition: rviewUtils.hh:297
Definition: rviewUtils.hh:680
void refreshSlices(bool force=FALSE)
virtual void OnSize(int w, int h)
struct section_desc_s section_desc_t
Definition: rviewOSection.hh:187
void setOId(const r_OId &oid)
virtual long getSectionProjection(unsigned int num)
#define TRUE
Definition: defs.h:67
virtual bool sectionValid(unsigned int num)
r_Point intersection
Definition: rviewOSection.hh:137
static const int osection_sheight
Definition: rviewOSection.hh:88
Definition: oid.hh:47
Definition: minterval.hh:249
struct section_part_s * partition
Definition: rviewOSection.hh:143
rviewOSectionImage(mdd_frame *mf, unsigned int flags=0)
Definition: rviewOSection.hh:51