ctkDICOMImage.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0.txt
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =========================================================================*/
  15. #ifndef __ctkDICOMImage_h
  16. #define __ctkDICOMImage_h
  17. // Qt includes
  18. #include <QObject>
  19. #include <QImage>
  20. #include "ctkDICOMWidgetsExport.h"
  21. class ctkDICOMImagePrivate;
  22. class DicomImage;
  23. /// \ingroup DICOM_Widgets
  24. ///
  25. /// \brief Wrapper around a DCMTK DicomImage.
  26. ///
  27. /// This class wraps a DicomImage object and exposes it as a Qt class.
  28. ///
  29. class CTK_DICOM_WIDGETS_EXPORT ctkDICOMImage : public QObject
  30. {
  31. Q_OBJECT
  32. Q_PROPERTY(unsigned long frameCount READ frameCount);
  33. public:
  34. /// \brief Construct a ctkDICOMImage
  35. /// The dicomImage pointer must remain valid during all the life of
  36. /// the constructed ctkDICOMImage.
  37. ///
  38. explicit ctkDICOMImage(DicomImage* dicomImage, QObject* parent = 0);
  39. virtual ~ctkDICOMImage();
  40. ///
  41. /// \brief Returns the pointer on the dicom image given in the constructor.
  42. ///
  43. /// This is provided as a utility function. Do not delete the returned
  44. /// pointer.
  45. /// TBD: Return a "const DicomImage*" instead?
  46. ///
  47. DicomImage* dicomImage() const;
  48. ///
  49. /// \brief Returns a specific frame of the dicom image
  50. ///
  51. QImage frame(int frame = 0) const;
  52. ///
  53. /// \brief Returns the number of frames contained in the dicom image.
  54. /// \sa DicomImage::getFrameCount()
  55. ///
  56. /// Please note that this function does not return the number of frames
  57. /// stored in the DICOM file/dataset. It rather refers to the number of
  58. /// frames processed by this class.
  59. ///
  60. unsigned long frameCount() const;
  61. protected:
  62. QScopedPointer<ctkDICOMImagePrivate> d_ptr;
  63. private:
  64. Q_DECLARE_PRIVATE(ctkDICOMImage);
  65. Q_DISABLE_COPY(ctkDICOMImage);
  66. };
  67. #endif