00001 //-------------------------------------------------- 00011 //--------------------------------------------------- 00012 00013 #ifndef IMEDGINE_IMAGE_PIXEL_VIEW_H 00014 #define IMEDGINE_IMAGE_PIXEL_VIEW_H 00015 00016 #include "pixel_view.h" 00017 #include "../global/global_definitions.h" 00018 #include "../datasets/dataset_definitions.h" 00019 #include "../exceptions/null_pointer_exception.h" 00020 #include "imedgine_image_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 //-------------------------------------------------- 00052 //-------------------------------------------------- 00053 00054 class ImagePixelView : public PixelView 00055 { 00056 public: 00057 00058 //-------------------------------------------------- 00061 00062 ImagePixelView(); 00063 00064 //-------------------------------------------------- 00067 00068 virtual ~ImagePixelView(); 00069 00070 //-------------------------------------------------- 00073 00074 view_pointer_type clone() const; 00075 00076 //-------------------------------------------------- 00080 00081 virtual void setDataset(dataset_pointer_type dataset) 00082 throw(NullPointerException, InvalidCastException); 00083 00084 //---------------------------------------------------- 00088 virtual double getMinPixelValue() const; 00089 00090 //---------------------------------------------------- 00094 virtual double getMaxPixelValue() const; 00095 00096 //-------------------------------------------------- 00102 00103 virtual void setIntensity(double window, double level) 00104 throw(NullPointerException); 00105 00106 //-------------------------------------------------- 00110 00111 virtual double getIntensityWindow() const; 00112 00113 //-------------------------------------------------- 00117 00118 virtual double getIntensityLevel() const; 00119 00120 //-------------------------------------------------- 00125 00126 dataset_key_type getDatasetKey() const; 00127 00128 //-------------------------------------------------- 00133 00134 dataset_position_type const& getSize() const; 00135 00136 //-------------------------------------------------- 00140 00141 virtual void setParent(QWidget* view_parent) 00142 throw(NullPointerException); 00143 00144 //-------------------------------------------------- 00147 00148 void updateView() throw(NullPointerException); 00149 00150 //-------------------------------------------------- 00156 00157 virtual void onDataChangedEvent(dataset_attribute_type changed_attribute) 00158 throw(NullPointerException); 00159 00160 //-------------------------------------------------- 00168 00169 virtual void setFocusPoint2D(index_type dim_1, index_type dim_2) 00170 throw(NullPointerException); 00171 00172 //-------------------------------------------------- 00176 00177 ImedgineImageViewer* getRenderArea() { return (render_area_.get()); } 00178 00179 SoSeparator* getDynamicSceneSeparator() const { return dynamic_sep_; } 00180 00181 SoMaterial* getSliceDatasetMaterial() { return (slice_dataset_material_); } 00182 00183 SoMaterial* getSliceSecondDatasetMaterial() { return (slice_second_dataset_material_); } 00184 00185 protected: 00186 00187 //-------------------------------------------------- 00190 00191 ImagePixelView(ImagePixelView const& src); 00192 00193 //-------------------------------------------------- 00198 00199 virtual void createSceneGraph(); 00200 00201 //-------------------------------------------------- 00206 00207 virtual void drawCrosshair(); 00208 00209 //-------------------------------------------------- 00211 00212 image_pixel_dataset_pointer_type image_dataset_; 00213 00214 //--------------------------------------------------- 00216 00217 std::auto_ptr<ImedgineImageViewer> render_area_; 00218 00219 //--------------------------------------------------- 00223 00224 SoOrthographicCamera* dynamic_camera_; 00225 00226 //--------------------------------------------------- 00229 00230 SoSeparator* slice_separator_; 00231 00232 SoMaterial* slice_dataset_material_; 00233 00234 //--------------------------------------------------- 00236 00237 SoTexture2* current_image_texture_; 00238 00239 //FIXME: this cube should be replaced by a plane 00240 SoCube* slice_plane_; 00241 00242 SoMaterial* slice_second_dataset_material_; 00243 00244 SoTexture2* current_second_image_texture_; 00245 00246 //FIXME: this cube should be replaced by a plane 00247 SoCube* second_slice_plane_; 00248 00249 //--------------------------------------------------- 00252 00253 SoSeparator* crosshair_sep_; 00254 00255 //--------------------------------------------------- 00257 00258 SoBaseColor* crosshair_color_; 00259 00260 //--------------------------------------------------- 00262 00263 SoCoordinate3* crosshair_coords_; 00264 00265 //--------------------------------------------------- 00267 00268 SoLineSet* crosshair_lines_; 00269 }; 00270 } 00271 00272 #endif