ctkDICOMCorePythonQtDecorators.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 __ctkDICOMCorePythonQtDecorators_h
  15. #define __ctkDICOMCorePythonQtDecorators_h
  16. // PythonQt includes
  17. #include <PythonQt.h>
  18. // CTK includes
  19. #include <ctkDICOMUtil.h>
  20. // NOTE:
  21. //
  22. // For decorators it is assumed that the methods will never be called
  23. // with the self argument as NULL. The self argument is the first argument
  24. // for non-static methods.
  25. //
  26. /// \ingroup DICOM_Core
  27. class ctkDICOMCorePythonQtDecorators : public QObject
  28. {
  29. Q_OBJECT
  30. public:
  31. ctkDICOMCorePythonQtDecorators()
  32. {
  33. }
  34. public Q_SLOTS:
  35. //
  36. // None yet - refer to other libs for examples
  37. //
  38. };
  39. //-----------------------------------------------------------------------------
  40. class PythonQtWrapper_CTKDICOMCore : public QObject
  41. {
  42. Q_OBJECT
  43. public Q_SLOTS:
  44. ctkErrorLogLevel::LogLevel static_ctk_dicomLogLevel()
  45. {
  46. return ctk::dicomLogLevel();
  47. }
  48. void static_ctk_setDICOMLogLevel(ctkErrorLogLevel::LogLevel level)
  49. {
  50. ctk::setDICOMLogLevel(level);
  51. }
  52. QString static_ctk_dicomLogLevelAsString()
  53. {
  54. return ctk::dicomLogLevelAsString();
  55. }
  56. };
  57. //-----------------------------------------------------------------------------
  58. void initCTKDICOMCorePythonQtDecorators()
  59. {
  60. PythonQt::self()->addDecorators(new ctkDICOMCorePythonQtDecorators);
  61. PythonQt::self()->registerCPPClass("ctk", "", "CTKDICOMCore", PythonQtCreateObject<PythonQtWrapper_CTKDICOMCore>);
  62. }
  63. #endif