EIMInterfaceDLL.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #ifndef _EIMinterfaceDLL_h_
  2. #define _EIMinterfaceDLL_h_
  3. #include "EIMResult.h"
  4. #ifdef WIN32
  5. #ifdef MATH_DLL_EXPORTS
  6. #define IMPORTEXPORT __declspec(dllexport)
  7. #else
  8. #define IMPORTEXPORT __declspec(dllimport)
  9. #endif
  10. #else
  11. #define IMPORTEXPORT
  12. #endif
  13. namespace imt
  14. {
  15. extern "C"
  16. {
  17. //========================================================
  18. // ========= Loading the image into memory ===================
  19. //========================================================
  20. /** @brief Loads an ultrasound image from a DICOM file.
  21. Files must conform to Dicom 3 Part 10. Currently only one B-mode region per Dicom file is supported.
  22. @param fileName A zero-terminated string containing the absolute file path.
  23. @param mmPerPixelX The pixel size in X coordinates (in mm) used for image calibration. Optional parameter - if you use the default value (-1.0) then the calibration information provided in the DICOM file is applied.
  24. @param mmPerPixelY The pixel size in Y coordinates (in mm) used for image calibration. Optional parameter - if you use the default value (-1.0) then the calibration information provided in the DICOM file is applied.
  25. @return TRUE on success and FALSE if the file could not be loaded.
  26. @throws No exception are thrown.
  27. **/
  28. IMPORTEXPORT bool initializeFromFile( const char* fileName, double mmPerPixelX = -1.0, double mmPerPixelY = -1.0 );
  29. /** @brief Loads an image from a pixel array.
  30. When dealing with bitmaps, the calling application needs to load the image using an appropriate GUI library
  31. (e.g. CImage object from ATL/MFC on Windows, QImage object from Qt on Linux).
  32. @param pixelArray The pixel array containing the image to load.
  33. @param width Width of the image (in pixels).
  34. @param height Height of the image (in pixels).
  35. @param bitsPerPixel Number of bits used per pixel in the array. The only supported values are 8, 24 and 32.
  36. @param upsideDown TRUE if the array defines a bottom-up image, otherwise FALSE.
  37. @param mmPerPixelX The pixel size in X coordinates (in mm) used for image calibration.
  38. @param mmPerPixelY The pixel size in Y coordinates (in mm) used for image calibration.
  39. @return TRUE on success and FALSE if calibrations are not valid or bitsPerPixel has unsupported value.
  40. @throws No exception are thrown.
  41. **/
  42. IMPORTEXPORT bool initializeFromRaw( const char* pixelArray, int width, int height, int bitsPerPixel, bool upsideDown, double mmPerPixelX, double mmPerPixelY );
  43. //========================================================
  44. // ========= Performing the measurement=====================
  45. //========================================================
  46. /**
  47. @brief Sets the first delimiter point specifying the measurement segment.
  48. @param x Pixel X coordinates of the point in the image (generally a mouse click position).
  49. @param y Pixel Y coordinates of the point in the image (generally a mouse click position).
  50. @return TRUE if there’s a valid loaded image – otherwise FALSE.
  51. @throws No exception are thrown.
  52. **/
  53. IMPORTEXPORT bool setFirstPoint( int x, int y );
  54. /**
  55. @brief Returns the distance (in mm) between the first segment point and a specified point.
  56. @param x Pixel X coordinates of the point in the image (generally a mouse click position).
  57. @param y Pixel Y coordinates of the point in the image (generally a mouse click position).
  58. @return The current distance between the two points in millimeters.
  59. @throws No exception are thrown.
  60. **/
  61. IMPORTEXPORT float getDistanceToFirstPoint( int x, int y );
  62. /**
  63. @brief Sets the second point of the user defined segment, triggers the calculation and fills parameter result with the measurement results.
  64. @param x Pixel X coordinates of the point in the image (generally a mouse click position).
  65. @param y Pixel Y coordinates of the point in the image (generally a mouse click position).
  66. @param result Pointer to a result container provided by the calling application. The memory allocated for this pointer needs to be free’d by the calling application.
  67. @return TRUE if there’s a valid loaded image – otherwise FALSE.
  68. @throws No exception are thrown.
  69. **/
  70. IMPORTEXPORT bool setSecondPoint( int x, int y, IMTResult* result );
  71. //========================================================
  72. // ========= Retrieving the loaded image from memory ==========
  73. //========================================================
  74. /**
  75. @brief Returns the width of the loaded image in pixels.
  76. @throws No exception are thrown.
  77. **/
  78. IMPORTEXPORT int getImageWidth();
  79. /**
  80. @brief Returns the height of the loaded image in pixels.
  81. @throws No exception are thrown.
  82. **/
  83. IMPORTEXPORT int getImageHeight();
  84. /**
  85. @brief Returns the number of bits each pixel of the loaded Image occupies.
  86. @throws No exception are thrown.
  87. **/
  88. IMPORTEXPORT int getImageBitsPerPixel();
  89. /**
  90. @brief Returns pointer to the pixel array of the image contained in the library.
  91. It may be used to display the ultrasound image in the user’s application.
  92. @return Depending on the initialization method used, this pointer either points to the DICOM pixel array allocated internally, or to the bitmap pixel array allocated by the calling application.
  93. @throws No exception are thrown.
  94. **/
  95. IMPORTEXPORT char* getPixelArray();
  96. }
  97. }
  98. #endif