Viewer
display a stack of images
gl_image_panel.h
Go to the documentation of this file.
00001 /*
00002  * This work is licensed under a Creative Commons 
00003  * Attribution-Noncommercial-Share Alike 3.0 United States License.
00004  * 
00005  *    http://creativecommons.org/licenses/by-nc-sa/3.0/us/
00006  * 
00007  * You are free:
00008  * 
00009  *    to Share - to copy, distribute, display, and perform the work
00010  *    to Remix - to make derivative works
00011  * 
00012  * Under the following conditions:
00013  * 
00014  *    Attribution. You must attribute the work in the manner specified by the
00015  *    author or licensor (but not in any way that suggests that they endorse you
00016  *    or your use of the work).
00017  * 
00018  *    Noncommercial. You may not use this work for commercial purposes.
00019  * 
00020  *    Share Alike. If you alter, transform, or build upon this work, you may
00021  *    distribute the resulting work only under the same or similar license to
00022  *    this one.
00023  * 
00024  * For any reuse or distribution, you must make clear to others the license
00025  * terms of this work. The best way to do this is by including this header.
00026  * 
00027  * Any of the above conditions can be waived if you get permission from the
00028  * copyright holder.
00029  * 
00030  * Apart from the remix rights granted under this license, nothing in this
00031  * license impairs or restricts the author's moral rights.
00032  */
00033 
00034 
00046 #ifndef GL_IMAGE_PANEL_H
00047 #define GL_IMAGE_PANEL_H
00048 
00049 #include <config.h>
00050 
00051 #include <qgl.h>
00052 
00053 #include <jwsc/image/image.h>
00054 #include <jwsc/imgblock/imgblock.h>
00055 
00056 class GLImagePanel : public QGLWidget
00057 {
00058     Q_OBJECT
00059 
00060 public:
00061 
00062     GLImagePanel(QWidget* parent = 0, const char* name = 0);
00063 
00064     virtual void set_imgblock(jwsc::Imgblock_f* img_blk);
00065 
00066 public slots:
00067 
00068     virtual void set_current_x_index(int index);
00069 
00070     virtual void set_current_y_index(int index);
00071 
00072     virtual void set_current_z_index(int index);
00073 
00074     virtual void set_draw_line(bool b);
00075 
00076 signals:
00077 
00078     void mouse_position_changed(int x, int y, int z, const jwsc::Pixel_f* px);
00079 
00080 protected:
00081 
00082     jwsc::Imgblock_f* img_blk;
00083 
00084     int current_x_index;
00085 
00086     int current_y_index;
00087 
00088     int current_z_index;
00089 
00090     int default_width;
00091 
00092     int default_height;
00093 
00094     bool draw_line;
00095 
00096     virtual void initializeGL();
00097 
00098     virtual void paintGL() = 0;
00099 
00100     virtual void resizeGL(int w, int h) = 0;
00101 
00102     virtual void mouseMoveEvent(QMouseEvent* event) = 0;
00103 };
00104 
00105 class GLImagePanelXY : public GLImagePanel
00106 {
00107     Q_OBJECT
00108 
00109 public:
00110 
00111     GLImagePanelXY(QWidget* parent, const char* name);
00112 
00113     void set_imgblock(jwsc::Imgblock_f* img_blk);
00114 
00115     void set_draw_x_line(bool b);
00116     void set_draw_y_line(bool b);
00117 
00118 public slots:
00119 
00120     void set_current_z_index(int index);
00121 
00122 protected:
00123 
00124     float* xy_img;
00125 
00126     int update_xy_img;
00127 
00128     bool draw_x_line;
00129     bool draw_y_line;
00130 
00131     void paintGL();
00132 
00133     void resizeGL(int w, int h);
00134 
00135     void mouseMoveEvent(QMouseEvent* event);
00136 };
00137 
00138 class GLImagePanelXZ : public GLImagePanel
00139 {
00140     Q_OBJECT
00141 
00142 public:
00143 
00144     GLImagePanelXZ(QWidget* parent, const char* name);
00145 
00146     void set_imgblock(jwsc::Imgblock_f* img_blk);
00147 
00148 public slots:
00149 
00150     void set_current_y_index(int index);
00151 
00152 protected:
00153 
00154     float* xz_img;
00155 
00156     int update_xz_img;
00157 
00158     void paintGL();
00159 
00160     void resizeGL(int w, int h);
00161 
00162     void mouseMoveEvent(QMouseEvent* event);
00163 };
00164 
00165 class GLImagePanelYZ : public GLImagePanel
00166 {
00167     Q_OBJECT
00168 
00169 public:
00170 
00171     GLImagePanelYZ(QWidget* parent, const char* name);
00172 
00173     void set_imgblock(jwsc::Imgblock_f* img_blk);
00174 
00175 public slots:
00176 
00177     void set_current_x_index(int index);
00178 
00179 protected:
00180 
00181     float* yz_img;
00182 
00183     int update_yz_img;
00184 
00185     void paintGL();
00186 
00187     void resizeGL(int w, int h);
00188 
00189     void mouseMoveEvent(QMouseEvent* event);
00190 };
00191 
00192 #endif