EIMInterfaceDLL.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 image from a DICOM file.
  21. TODO - Specify which type of Dicom files may be used here (2D ultrasound bmode single image?).
  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 TODO - add info on possible exceptions here
  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. TODO - Specify the structure of the array!
  31. @param pixelArray The pixel array containing the image to load.
  32. @param width Width of the image (in pixels).
  33. @param height Height of the image (in pixels).
  34. @param bitsPerPixel Number of bits used per pixel in the array. The only supported values are 8, 24 and 32.
  35. @param upsideDown TRUE if the array defines a bottom-up image, otherwise FALSE.
  36. @param mmPerPixelX The pixel size in X coordinates (in mm) used for image calibration.
  37. @param mmPerPixelY The pixel size in Y coordinates (in mm) used for image calibration.
  38. @return TRUE on success and FALSE if calibrations are not valid or bitsPerPixel has unsupported value.
  39. @throws TODO - add info on possible exceptions here
  40. **/
  41. IMPORTEXPORT bool initializeFromRaw( const char* pixelArray, int width, int height, int bitsPerPixel, bool upsideDown, double mmPerPixelX, double mmPerPixelY );
  42. //========================================================
  43. // ========= Performing the measurement=====================
  44. //========================================================
  45. /**
  46. @brief Sets the first point of the user defined segment.
  47. @param x Pixel X coordinates of the point in the image (generally a mouse click position).
  48. @param y Pixel Y coordinates of the point in the image (generally a mouse click position).
  49. @return TRUE if there’s a valid loaded image – otherwise FALSE.
  50. @throws TODO - add info on possible exceptions here
  51. **/
  52. IMPORTEXPORT bool setFirstPoint( int x, int y );
  53. /**
  54. @brief Returns the distance (in mm) between the first segment point and a specified point.
  55. @param x Pixel X coordinates of the point in the image (generally a mouse click position).
  56. @param y Pixel Y coordinates of the point in the image (generally a mouse click position).
  57. @return The current distance between the two points in millimeters.
  58. @throws TODO - add info on possible exceptions here
  59. **/
  60. IMPORTEXPORT float getDistanceToFirstPoint( int x, int y );
  61. /**
  62. @brief Sets the second point of the user defined segment, triggers the calculation and fills parameter result with the measurement results.
  63. @param x Pixel X coordinates of the point in the image (generally a mouse click position).
  64. @param y Pixel Y coordinates of the point in the image (generally a mouse click position).
  65. @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.
  66. @return TRUE if there’s a valid loaded image – otherwise FALSE.
  67. @throws TODO - add info on possible exceptions here
  68. **/
  69. IMPORTEXPORT bool setSecondPoint( int x, int y, IMTResult* result );
  70. //========================================================
  71. // ========= Retrieving the loaded image from memory ==========
  72. //========================================================
  73. /**
  74. @brief Returns the width of the loaded image in pixels.
  75. @throws TODO - add info on possible exceptions here
  76. **/
  77. IMPORTEXPORT int getImageWidth();
  78. /**
  79. @brief Returns the height of the loaded image in pixels.
  80. @throws TODO - add info on possible exceptions here
  81. **/
  82. IMPORTEXPORT int getImageHeight();
  83. /**
  84. @brief Returns the number of bits each pixel of the loaded Image occupies.
  85. @throws TODO - add info on possible exceptions here
  86. **/
  87. IMPORTEXPORT int getImageBitsPerPixel();
  88. /**
  89. @brief Returns a pixel array representing the loaded image (e.g. via. call to imt::initializeFromFile).
  90. @return TODO - Specify the structure of the array!
  91. @throws TODO - add info on possible exceptions here
  92. **/
  93. IMPORTEXPORT char* getPixelArray(); // to retrieve pixel array of Dicom files ; or equal to pixelArray passed to initializeFromRaw()
  94. }
  95. }
  96. #endif