ctkQImageView.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.commontk.org/LICENSE
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkQImageView_h
  15. #define __ctkQImageView_h
  16. /// Qt includes
  17. #include <QWidget>
  18. #include <QImage>
  19. /// CTK includes
  20. #include "ctkPimpl.h"
  21. #include "ctkWidgetsExport.h"
  22. class ctkQImageViewPrivate;
  23. ///
  24. /// ctkQImageView is the base class of image viewer widgets.
  25. class CTK_WIDGETS_EXPORT ctkQImageView: public QWidget
  26. {
  27. Q_OBJECT
  28. public:
  29. /// Superclass typedef
  30. typedef QWidget Superclass;
  31. /// Constructor
  32. ctkQImageView( QWidget* parent = 0 );
  33. /// Destructor
  34. virtual ~ctkQImageView( void );
  35. double xSpacing( void );
  36. double ySpacing( void );
  37. double sliceThickness( void );
  38. double xPosition( void );
  39. double yPosition( void );
  40. double slicePosition( void );
  41. double positionValue( void );
  42. double xCenter( void );
  43. double yCenter( void );
  44. int sliceNumber( void ) const;
  45. int numberOfSlices( void ) const;
  46. double intensityWindowMin( void ) const;
  47. double intensityWindowMax( void ) const;
  48. bool flipXAxis( void ) const;
  49. bool flipYAxis( void ) const;
  50. bool transposeXY( void ) const;
  51. double zoom( void );
  52. public slots:
  53. void addImage( const QImage & image );
  54. void clearImages( void );
  55. void setSliceNumber( int slicenum );
  56. void setIntensityWindow( double iwMin, double iwMax );
  57. void setFlipXAxis( bool flip );
  58. void setFlipYAxis( bool flip );
  59. void setTransposeXY( bool transpose );
  60. virtual void keyPressEvent( QKeyEvent * event );
  61. virtual void mousePressEvent( QMouseEvent * event );
  62. virtual void mouseReleaseEvent( QMouseEvent * event );
  63. virtual void mouseMoveEvent( QMouseEvent * event );
  64. void setCenter( double x, double y );
  65. void setPosition( double x, double y );
  66. void setZoom( double factor );
  67. void reset();
  68. virtual void update( bool zoomChanged=false, bool sizeChanged=false );
  69. signals:
  70. void xSpacingChanged( double xSpacing );
  71. void ySpacingChanged( double ySpacing );
  72. void sliceThicknessChanged( double sliceThickness );
  73. void xPositionChanged( double xPosition );
  74. void yPositionChanged( double yPosition );
  75. void slicePositionChanged( double slicePosition );
  76. void positionValueChanged( double positionValue );
  77. void sliceNumberChanged( int sliceNum );
  78. void zoomChanged( double factor );
  79. void xCenterChanged( double x );
  80. void yCenterChanged( double y );
  81. void numberOfSlicesChanged( int numberOfSlices );
  82. void flipXAxisChanged( bool flipXAxis );
  83. void flipYAxisChanged( bool flipYAxis );
  84. void transposeXYChanged( bool transposeXY );
  85. void intensityWindowMinChanged( double intensityWindowMin );
  86. void intensityWindowMaxChanged( double intensityWindowMax );
  87. protected:
  88. virtual void resizeEvent( QResizeEvent* event );
  89. /// protected constructor to derive private implementations
  90. ctkQImageView( ctkQImageViewPrivate & pvt,
  91. QWidget* parent=0 );
  92. private:
  93. QScopedPointer< ctkQImageViewPrivate > d_ptr;
  94. Q_DECLARE_PRIVATE( ctkQImageView );
  95. Q_DISABLE_COPY( ctkQImageView );
  96. };
  97. #endif