ctkQImageView.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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.apache.org/licenses/LICENSE-2.0.txt
  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. /// \ingroup Widgets
  24. ///
  25. /// ctkQImageView is the base class of image viewer widgets.
  26. class CTK_WIDGETS_EXPORT ctkQImageView: public QWidget
  27. {
  28. Q_OBJECT
  29. public:
  30. /// Superclass typedef
  31. typedef QWidget Superclass;
  32. /// Constructor
  33. ctkQImageView( QWidget* parent = 0 );
  34. /// Destructor
  35. virtual ~ctkQImageView( void );
  36. double xSpacing( void );
  37. double ySpacing( void );
  38. double sliceSpacing( void );
  39. double sliceThickness( void );
  40. double xPosition( void );
  41. double yPosition( void );
  42. double slicePosition( void );
  43. double positionValue( void );
  44. double xCenter( void );
  45. double yCenter( void );
  46. int sliceNumber( void ) const;
  47. int numberOfSlices( void ) const;
  48. double intensityWindow( void ) const;
  49. double intensityLevel( void ) const;
  50. bool invertImage( void ) const;
  51. bool flipXAxis( void ) const;
  52. bool flipYAxis( void ) const;
  53. bool transposeXY( void ) const;
  54. double zoom( void );
  55. public Q_SLOTS:
  56. void addImage( const QImage & image );
  57. void clearImages( void );
  58. void setSliceNumber( int slicenum );
  59. void setIntensityWindowLevel( double iwWindow, double iwLevel );
  60. void setInvertImage( bool invert );
  61. void setFlipXAxis( bool flip );
  62. void setFlipYAxis( bool flip );
  63. void setTransposeXY( bool transpose );
  64. virtual void keyPressEvent( QKeyEvent * event );
  65. virtual void mousePressEvent( QMouseEvent * event );
  66. virtual void mouseReleaseEvent( QMouseEvent * event );
  67. virtual void mouseMoveEvent( QMouseEvent * event );
  68. virtual void enterEvent( QEvent * event );
  69. virtual void leaveEvent( QEvent * event );
  70. void setCenter( double x, double y );
  71. void setPosition( double x, double y );
  72. void setZoom( double factor );
  73. void reset();
  74. virtual void update( bool zoomChanged=false, bool sizeChanged=false );
  75. Q_SIGNALS:
  76. void xSpacingChanged( double xSpacing );
  77. void ySpacingChanged( double ySpacing );
  78. void sliceThicknessChanged( double sliceThickness );
  79. void xPositionChanged( double xPosition );
  80. void yPositionChanged( double yPosition );
  81. void slicePositionChanged( double slicePosition );
  82. void positionValueChanged( double positionValue );
  83. void sliceNumberChanged( int sliceNum );
  84. void zoomChanged( double factor );
  85. void xCenterChanged( double x );
  86. void yCenterChanged( double y );
  87. void numberOfSlicesChanged( int numberOfSlices );
  88. void invertImageChanged( bool invert );
  89. void flipXAxisChanged( bool flipXAxis );
  90. void flipYAxisChanged( bool flipYAxis );
  91. void transposeXYChanged( bool transposeXY );
  92. void intensityWindowChanged( double intensityWindow );
  93. void intensityLevelChanged( double intensityLevel );
  94. protected:
  95. virtual void resizeEvent( QResizeEvent* event );
  96. /// protected constructor to derive private implementations
  97. ctkQImageView( ctkQImageViewPrivate & pvt,
  98. QWidget* parent=0 );
  99. private:
  100. QScopedPointer< ctkQImageViewPrivate > d_ptr;
  101. Q_DECLARE_PRIVATE( ctkQImageView );
  102. Q_DISABLE_COPY( ctkQImageView );
  103. };
  104. #endif