00001 //-------------------------------------------------- 00011 //--------------------------------------------------- 00012 00013 #ifndef IMEDGINEIMEDGINE_SLICE_VIEWER_H 00014 #define IMEDGINEIMEDGINE_SLICE_VIEWER_H 00015 00016 #include "imedgine_viewer.h" 00017 #include "../global/global_definitions.h" 00018 #include "view_definitions.h" 00019 #include "../datasets/dataset.h" 00020 #include "../exceptions/null_pointer_exception.h" 00021 00022 #include <Inventor/SbTime.h> 00023 #include <Inventor/nodes/SoCube.h> 00024 #include <Inventor/nodes/SoTransform.h> 00025 #include <Inventor/nodes/SoText2.h> 00026 #include <Inventor/nodes/SoMaterial.h> 00027 #include <Inventor/nodes/SoSwitch.h> 00028 #include <Inventor/draggers/SoTranslate1Dragger.h> 00029 00030 namespace imedgine 00031 { 00032 //-------------------------------------------------- 00034 class ROIBase; 00035 00036 //-------------------------------------------------- 00038 00039 class SlicePixelView; 00040 00041 //-------------------------------------------------- 00045 00046 void sliceSliderPositionChangedCB(void *data, SoSensor* sensor); 00047 00048 //-------------------------------------------------- 00054 00055 void transparencySliderPositionChangedCB(void *data, SoSensor* sensor); 00056 00057 //-------------------------------------------------- 00068 //-------------------------------------------------- 00069 00070 00071 class ImedgineSliceViewer : public ImedgineViewer 00072 { 00073 public: 00074 00075 //-------------------------------------------------- 00078 00079 ImedgineSliceViewer(SlicePixelView* slice_view, QWidget* parent, const char* name = NULL); 00080 00081 //-------------------------------------------------- 00084 00085 virtual ~ImedgineSliceViewer(); 00086 00087 //-------------------------------------------------- 00092 00093 virtual SbBool processSoEvent(const SoEvent * const ev); 00094 00095 //-------------------------------------------------- 00104 00105 bool convertCoordsFromScreenToTexture(SbVec2s const& screen_coords, SbVec2s& texture_coords); 00106 00107 //-------------------------------------------------- 00112 00113 void convertCoordsFromTextureToWorld(SbVec2s const& texture_coords, SbVec2f& space_coords); 00114 00115 //-------------------------------------------------- 00121 00122 void updateSliceStatusInfo(index_type current_slice_index, index_type maximum_slice_index); 00123 00124 //-------------------------------------------------- 00130 00131 void updateDatasetStatusInfo(); 00132 00133 //-------------------------------------------------- 00136 00137 void unsetHybridView(); 00138 00139 //-------------------------------------------------- 00142 00143 void updateSliceSliderPosition(index_type slice_index); 00144 00145 SlicePixelView* getSlicePixelView() { return (slice_view_); } 00146 00147 SoTranslate1Dragger* getSliceSliderDragger() { return (slice_slider_dragger_); } 00148 00149 SoTranslate1Dragger* getTransparencySliderDragger() { return (transparency_slider_dragger_); } 00150 00151 bool getIgnoreNextSliceSliderUpdate() { return (ignore_next_slice_slider_update_); } 00152 00153 void setIgnoreNextSliceSliderUpdate(bool ignore_next_slice_slider_update) 00154 { 00155 ignore_next_slice_slider_update_ = ignore_next_slice_slider_update; 00156 } 00157 00158 protected: 00159 00160 //-------------------------------------------------- 00164 00165 virtual void buildPopupMenu(); 00166 00167 //-------------------------------------------------- 00175 00176 virtual void menuSelection(int menu_item_id); 00177 00178 //-------------------------------------------------- 00183 00184 SbVec3f convertCoordsFromWorldToSpace(SbVec2s screen_coords) 00185 throw(NullPointerException); 00186 00187 //-------------------------------------------------- 00190 00191 SlicePixelView* slice_view_; 00192 00193 //-------------------------------------------------- 00196 00197 view_mode_type view_mode_; 00198 00199 //-------------------------------------------------- 00202 00203 SoSeparator* popup_button_sep_; 00204 00205 //-------------------------------------------------- 00208 00209 SoCube* popup_button_; 00210 00211 //-------------------------------------------------- 00214 00215 SoSeparator* status_info_sep_; 00216 00217 //-------------------------------------------------- 00221 00222 SoTransform* slice_status_info_transform_; 00223 00224 //-------------------------------------------------- 00227 00228 SoText2* slice_status_info_text_; 00229 00230 //-------------------------------------------------- 00234 00235 SoTransform* dataset_status_info_transform_; 00236 00237 //-------------------------------------------------- 00241 00242 SoText2* dataset_status_info_text_; 00243 00244 //-------------------------------------------------- 00247 00248 SoSeparator* slice_slider_sep_; 00249 00250 //-------------------------------------------------- 00253 00254 SoTranslate1Dragger* slice_slider_dragger_; 00255 00256 //-------------------------------------------------- 00260 00261 SoSwitch* transparency_slider_switch_; 00262 00263 //-------------------------------------------------- 00269 00270 SoSeparator* transparency_slider_sep_; 00271 00272 //-------------------------------------------------- 00275 00276 SoTranslate1Dragger* transparency_slider_dragger_; 00277 00278 //-------------------------------------------------- 00281 00282 SoSeparator* region_of_interest_sep_; 00283 00284 //-------------------------------------------------- 00287 00288 ROIBase* region_of_interest_; 00289 00290 //-------------------------------------------------- 00294 00295 std::auto_ptr<SoMouseButtonEvent> last_button_click_event_; 00296 00297 //-------------------------------------------------- 00300 00301 SbVec2s last_position_; 00302 00303 //-------------------------------------------------- 00306 00307 SoQtPopupMenu *popup_menu; 00308 00309 //-------------------------------------------------- 00313 00314 SbTime double_click_check_time_; 00315 00316 //-------------------------------------------------- 00319 00320 SbVec2s left_mouse_button_press_location_; 00321 00322 //-------------------------------------------------- 00325 00326 bool is_hybrid_view_; 00327 00328 //-------------------------------------------------- 00334 double mouse_movement_scaling_factor_; 00335 00336 //-------------------------------------------------- 00341 00342 bool ignore_next_slice_slider_update_; 00343 }; 00344 } 00345 00346 #endif