ctkDICOMItemView.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 __ctkDICOMItemView_h
  15. #define __ctkDICOMItemView_h
  16. /// Qt includes
  17. #include <QWidget>
  18. #include <QImage>
  19. #include <QModelIndex>
  20. /// CTK includes
  21. #include "ctkQImageView.h"
  22. #include "ctkPimpl.h"
  23. #include "ctkDICOMWidgetsExport.h"
  24. class ctkDICOMItemViewPrivate;
  25. class DicomImage;
  26. /// \ingroup DICOM_Widgets
  27. ///
  28. /// ctkDICOMItemView is the base class of image viewer widgets.
  29. class CTK_DICOM_WIDGETS_EXPORT ctkDICOMItemView
  30. : public ctkQImageView
  31. {
  32. Q_OBJECT
  33. public:
  34. /// Superclass typedef
  35. typedef ctkQImageView Superclass;
  36. /// Constructor
  37. ctkDICOMItemView( QWidget * parent = 0 );
  38. /// Destructor
  39. virtual ~ctkDICOMItemView( void );
  40. void setDatabaseDirectory(const QString& directory);
  41. QModelIndex currentImageIndex();
  42. Q_SIGNALS:
  43. void requestNextImage();
  44. void requestPreviousImage();
  45. void imageDisplayed(int imageID, int count);
  46. public Q_SLOTS:
  47. void addImage( const QImage & image );
  48. void addImage( DicomImage & dcmImage, bool defaultIntensity = true);
  49. void onModelSelected(const QModelIndex& index);
  50. void displayImage(int imageIndex);
  51. virtual void update( bool zoomChanged=false, bool sizeChanged=false );
  52. protected:
  53. /// protected constructor to derive private implementations
  54. ctkDICOMItemView( ctkDICOMItemViewPrivate & pvt,
  55. QWidget* parent=0 );
  56. /// re-implemented QWidget event functions
  57. virtual void mousePressEvent( QMouseEvent * event );
  58. virtual void mouseMoveEvent( QMouseEvent * event );
  59. private:
  60. QScopedPointer< ctkDICOMItemViewPrivate > d_ptr;
  61. Q_DECLARE_PRIVATE( ctkDICOMItemView );
  62. Q_DISABLE_COPY( ctkDICOMItemView );
  63. void emitImageDisplayedSignal(int imageID, int count);
  64. };
  65. #endif