comparison Plugins/OrthancCPlugin/OrthancCPlugin.h @ 1145:0479d02c6778

Plugins can retrieve the path to Orthanc and to its configuration file
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Sep 2014 13:06:16 +0200
parents 2ff467bcfb98
children 5b2d8c280ac2
comparison
equal deleted inserted replaced
1144:fef79a477e09 1145:0479d02c6778
235 { 235 {
236 /* Generic services */ 236 /* Generic services */
237 _OrthancPluginService_LogInfo = 1, 237 _OrthancPluginService_LogInfo = 1,
238 _OrthancPluginService_LogWarning = 2, 238 _OrthancPluginService_LogWarning = 2,
239 _OrthancPluginService_LogError = 3, 239 _OrthancPluginService_LogError = 3,
240 _OrthancPluginService_GetOrthancPath = 4,
241 _OrthancPluginService_GetOrthancDirectory = 5,
242 _OrthancPluginService_GetConfigurationPath = 6,
240 243
241 /* Registration of callbacks */ 244 /* Registration of callbacks */
242 _OrthancPluginService_RegisterRestCallback = 1000, 245 _OrthancPluginService_RegisterRestCallback = 1000,
243 _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001, 246 _OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
244 _OrthancPluginService_RegisterStorageArea = 1002, 247 _OrthancPluginService_RegisterStorageArea = 1002,
939 942
940 943
941 944
942 typedef struct 945 typedef struct
943 { 946 {
944 char** result; 947 char** result;
945 const char* identifier; 948 const char* argument;
946 } _OrthancPluginLookupResource; 949 } _OrthancPluginRetrieveDynamicString;
947 950
948 /** 951 /**
949 * @brief Look for a patient. 952 * @brief Look for a patient.
950 * 953 *
951 * Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020). 954 * Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020).
961 OrthancPluginContext* context, 964 OrthancPluginContext* context,
962 const char* patientID) 965 const char* patientID)
963 { 966 {
964 char* result; 967 char* result;
965 968
966 _OrthancPluginLookupResource params; 969 _OrthancPluginRetrieveDynamicString params;
967 params.result = &result; 970 params.result = &result;
968 params.identifier = patientID; 971 params.argument = patientID;
969 972
970 if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params)) 973 if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params))
971 { 974 {
972 /* Error */ 975 /* Error */
973 return NULL; 976 return NULL;
995 OrthancPluginContext* context, 998 OrthancPluginContext* context,
996 const char* studyUID) 999 const char* studyUID)
997 { 1000 {
998 char* result; 1001 char* result;
999 1002
1000 _OrthancPluginLookupResource params; 1003 _OrthancPluginRetrieveDynamicString params;
1001 params.result = &result; 1004 params.result = &result;
1002 params.identifier = studyUID; 1005 params.argument = studyUID;
1003 1006
1004 if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params)) 1007 if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params))
1005 { 1008 {
1006 /* Error */ 1009 /* Error */
1007 return NULL; 1010 return NULL;
1029 OrthancPluginContext* context, 1032 OrthancPluginContext* context,
1030 const char* accessionNumber) 1033 const char* accessionNumber)
1031 { 1034 {
1032 char* result; 1035 char* result;
1033 1036
1034 _OrthancPluginLookupResource params; 1037 _OrthancPluginRetrieveDynamicString params;
1035 params.result = &result; 1038 params.result = &result;
1036 params.identifier = accessionNumber; 1039 params.argument = accessionNumber;
1037 1040
1038 if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, &params)) 1041 if (context->InvokeService(context, _OrthancPluginService_LookupStudyWithAccessionNumber, &params))
1039 { 1042 {
1040 /* Error */ 1043 /* Error */
1041 return NULL; 1044 return NULL;
1063 OrthancPluginContext* context, 1066 OrthancPluginContext* context,
1064 const char* seriesUID) 1067 const char* seriesUID)
1065 { 1068 {
1066 char* result; 1069 char* result;
1067 1070
1068 _OrthancPluginLookupResource params; 1071 _OrthancPluginRetrieveDynamicString params;
1069 params.result = &result; 1072 params.result = &result;
1070 params.identifier = seriesUID; 1073 params.argument = seriesUID;
1071 1074
1072 if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params)) 1075 if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params))
1073 { 1076 {
1074 /* Error */ 1077 /* Error */
1075 return NULL; 1078 return NULL;
1097 OrthancPluginContext* context, 1100 OrthancPluginContext* context,
1098 const char* sopInstanceUID) 1101 const char* sopInstanceUID)
1099 { 1102 {
1100 char* result; 1103 char* result;
1101 1104
1102 _OrthancPluginLookupResource params; 1105 _OrthancPluginRetrieveDynamicString params;
1103 params.result = &result; 1106 params.result = &result;
1104 params.identifier = sopInstanceUID; 1107 params.argument = sopInstanceUID;
1105 1108
1106 if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params)) 1109 if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params))
1107 { 1110 {
1108 /* Error */ 1111 /* Error */
1109 return NULL; 1112 return NULL;
1544 1547
1545 context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params); 1548 context->InvokeService(context, _OrthancPluginService_RegisterStorageArea, &params);
1546 } 1549 }
1547 1550
1548 1551
1552
1553 /**
1554 * @brief Return the path to the Orthanc executable.
1555 *
1556 * This function returns the path to the Orthanc executable.
1557 *
1558 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1559 * @return NULL in the case of an error, or a newly allocated string
1560 * containing the path. This string must be freed by
1561 * OrthancPluginFreeString().
1562 **/
1563 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancPath(OrthancPluginContext* context)
1564 {
1565 char* result;
1566
1567 _OrthancPluginRetrieveDynamicString params;
1568 params.result = &result;
1569 params.argument = NULL;
1570
1571 if (context->InvokeService(context, _OrthancPluginService_GetOrthancPath, &params))
1572 {
1573 /* Error */
1574 return NULL;
1575 }
1576 else
1577 {
1578 return result;
1579 }
1580 }
1581
1582
1583 /**
1584 * @brief Return the directory containing the Orthanc.
1585 *
1586 * This function returns the path to the directory containing the Orthanc executable.
1587 *
1588 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1589 * @return NULL in the case of an error, or a newly allocated string
1590 * containing the path. This string must be freed by
1591 * OrthancPluginFreeString().
1592 **/
1593 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetOrthancDirectory(OrthancPluginContext* context)
1594 {
1595 char* result;
1596
1597 _OrthancPluginRetrieveDynamicString params;
1598 params.result = &result;
1599 params.argument = NULL;
1600
1601 if (context->InvokeService(context, _OrthancPluginService_GetOrthancDirectory, &params))
1602 {
1603 /* Error */
1604 return NULL;
1605 }
1606 else
1607 {
1608 return result;
1609 }
1610 }
1611
1612
1613 /**
1614 * @brief Return the path to the configuration file.
1615 *
1616 * This function returns the path to the configuration file that was
1617 * specified when starting Orthanc.
1618 *
1619 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize().
1620 * @return NULL in the case of an error, or a newly allocated string
1621 * containing the path. This string must be freed by
1622 * OrthancPluginFreeString().
1623 **/
1624 ORTHANC_PLUGIN_INLINE char *OrthancPluginGetConfigurationPath(OrthancPluginContext* context)
1625 {
1626 char* result;
1627
1628 _OrthancPluginRetrieveDynamicString params;
1629 params.result = &result;
1630 params.argument = NULL;
1631
1632 if (context->InvokeService(context, _OrthancPluginService_GetConfigurationPath, &params))
1633 {
1634 /* Error */
1635 return NULL;
1636 }
1637 else
1638 {
1639 return result;
1640 }
1641 }
1642
1643
1644
1549 #ifdef __cplusplus 1645 #ifdef __cplusplus
1550 } 1646 }
1551 #endif 1647 #endif
1552 1648
1553 1649