00001 //-------------------------------------------------- 00012 //--------------------------------------------------- 00013 00014 #ifndef IMEDGINE_SLICE_PIXEL_VIEW_H 00015 #define IMEDGINE_SLICE_PIXEL_VIEW_H 00016 00017 #include "volume_pixel_view.h" 00018 #include "../global/global_definitions.h" 00019 #include "../exceptions/null_pointer_exception.h" 00020 #include "imedgine_slice_viewer.h" 00021 00022 #include <memory> // std::auto_ptr 00023 00024 #include <Inventor/fields/SoSFImage.h> 00025 #include <Inventor/nodes/SoTexture2.h> 00026 #include <Inventor/nodes/SoEventCallback.h> 00027 #include <Inventor/nodes/SoCube.h> 00028 #include <Inventor/nodes/SoMaterial.h> 00029 #include <Inventor/events/SoMouseButtonEvent.h> 00030 #include <Inventor/events/SoKeyboardEvent.h> 00031 #include <Inventor/nodes/SoOrthographicCamera.h> 00032 00033 //CROSSHAIR includes 00034 #include <Inventor/nodes/SoImage.h> 00035 #include <Inventor/nodes/SoCoordinate3.h> 00036 #include <Inventor/nodes/SoLineSet.h> 00037 #include <Inventor/nodes/SoBaseColor.h> 00038 00039 namespace imedgine 00040 { 00041 //-------------------------------------------------- 00053 //-------------------------------------------------- 00054 00055 class SlicePixelView : public VolumePixelView 00056 { 00057 public: 00058 00059 //-------------------------------------------------- 00062 00063 SlicePixelView(view_type type); 00064 00065 //-------------------------------------------------- 00068 00069 virtual ~SlicePixelView(); 00070 00071 //-------------------------------------------------- 00075 00076 virtual void setDataset(dataset_pointer_type dataset) 00077 throw(NullPointerException, InvalidCastException); 00078 00079 //-------------------------------------------------- 00083 00084 void setSecondDataset(dataset_pointer_type second_dataset) 00085 throw(NullPointerException, InvalidCastException); 00086 00087 //-------------------------------------------------- 00090 00091 void unsetSecondDataset(); 00092 00093 //-------------------------------------------------- 00101 00102 virtual void onDatasetDeletion(dataset_key_type dataset_key); 00103 00104 //-------------------------------------------------- 00108 00109 virtual void setParent(QWidget* view_parent) 00110 throw(NullPointerException); 00111 00112 //-------------------------------------------------- 00115 00116 void updateView() throw(NullPointerException); 00117 00118 //-------------------------------------------------- 00124 00125 virtual void onDataChangedEvent(dataset_attribute_type changed_attribute) 00126 throw(NullPointerException); 00127 00128 //-------------------------------------------------- 00136 00137 virtual void setFocusPoint2D(index_type dim_1, index_type dim_2) = 0; 00138 00139 //-------------------------------------------------- 00145 00146 virtual void setSliceIndex(index_type slice_index) = 0; 00147 00148 //-------------------------------------------------- 00152 00153 virtual index_type getSliceIndex() const = 0; 00154 00155 //-------------------------------------------------- 00159 00160 virtual SbVec2s getSliceResolution() const = 0; 00161 00162 //-------------------------------------------------- 00167 00168 virtual index_type getNumSlices() const = 0; 00169 00170 //-------------------------------------------------- 00175 00176 virtual SbVec2s getSecondSliceResolution() const = 0; 00177 00178 //-------------------------------------------------- 00182 00183 ImedgineSliceViewer* getRenderArea() { return (render_area_.get()); } 00184 00185 SoSeparator* getDynamicSceneSeparator() const { return dynamic_sep_; } 00186 00187 SoMaterial* getSliceDatasetMaterial() { return (slice_dataset_material_); } 00188 00189 SoMaterial* getSliceSecondDatasetMaterial() { return (slice_second_dataset_material_); } 00190 00191 SoCube* getSlicePlane() { return (slice_plane_); } 00192 00193 protected: 00194 00195 //-------------------------------------------------- 00198 00199 SlicePixelView(SlicePixelView const& src); 00200 00201 //-------------------------------------------------- 00206 00207 virtual void createSceneGraph(); 00208 00209 //-------------------------------------------------- 00214 00215 virtual void drawCrosshair() = 0; 00216 00217 //--------------------------------------------------- 00219 std::auto_ptr<ImedgineSliceViewer> render_area_; 00220 00221 //--------------------------------------------------- 00225 SoOrthographicCamera* dynamic_camera_; 00226 00227 //--------------------------------------------------- 00230 SoSeparator* slice_separator_; 00231 00232 //--------------------------------------------------- 00234 SoCube* slice_plane_; 00235 00236 //--------------------------------------------------- 00238 SoCube* second_slice_plane_; 00239 00240 //--------------------------------------------------- 00242 SoTexture2* current_image_texture_; 00243 00244 //--------------------------------------------------- 00246 SoTexture2* current_second_image_texture_; 00247 00248 SoMaterial* slice_dataset_material_; 00249 00250 SoMaterial* slice_second_dataset_material_; 00251 00252 //--------------------------------------------------- 00255 SoSeparator* crosshair_sep_; 00256 00257 //--------------------------------------------------- 00259 SoBaseColor* crosshair_color_; 00260 00261 //--------------------------------------------------- 00263 SoCoordinate3* crosshair_coords_; 00264 00265 //--------------------------------------------------- 00267 SoLineSet* crosshair_lines_; 00268 }; 00269 } 00270 00271 #endif