comparison Plugins/OrthancCPlugin/OrthancCPlugin.h @ 1067:ace99e272203

access metadata in plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 28 Jul 2014 11:09:03 +0200
parents bb82e5e818e9
children f54a9c6fea5d
comparison
equal deleted inserted replaced
1066:bb82e5e818e9 1067:ace99e272203
263 /* Access to DICOM instances */ 263 /* Access to DICOM instances */
264 _OrthancPluginService_GetInstanceRemoteAet = 4000, 264 _OrthancPluginService_GetInstanceRemoteAet = 4000,
265 _OrthancPluginService_GetInstanceSize = 4001, 265 _OrthancPluginService_GetInstanceSize = 4001,
266 _OrthancPluginService_GetInstanceData = 4002, 266 _OrthancPluginService_GetInstanceData = 4002,
267 _OrthancPluginService_GetInstanceJson = 4003, 267 _OrthancPluginService_GetInstanceJson = 4003,
268 _OrthancPluginService_GetInstanceSimplifiedJson = 4004 268 _OrthancPluginService_GetInstanceSimplifiedJson = 4004,
269 269 _OrthancPluginService_HasInstanceMetadata = 4005,
270 /* + METADATA !!! */ 270 _OrthancPluginService_GetInstanceMetadata = 4006
271 } _OrthancPluginService; 271 } _OrthancPluginService;
272 272
273 273
274 274
275 /** 275 /**
887 params.result = &result; 887 params.result = &result;
888 params.identifier = patientID; 888 params.identifier = patientID;
889 889
890 if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params)) 890 if (context->InvokeService(context, _OrthancPluginService_LookupPatient, &params))
891 { 891 {
892 /* Error */
892 return NULL; 893 return NULL;
893 } 894 }
894 else 895 else
895 { 896 {
896 return result; 897 return result;
918 params.result = &result; 919 params.result = &result;
919 params.identifier = studyUID; 920 params.identifier = studyUID;
920 921
921 if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params)) 922 if (context->InvokeService(context, _OrthancPluginService_LookupStudy, &params))
922 { 923 {
924 /* Error */
923 return NULL; 925 return NULL;
924 } 926 }
925 else 927 else
926 { 928 {
927 return result; 929 return result;
949 params.result = &result; 951 params.result = &result;
950 params.identifier = seriesUID; 952 params.identifier = seriesUID;
951 953
952 if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params)) 954 if (context->InvokeService(context, _OrthancPluginService_LookupSeries, &params))
953 { 955 {
956 /* Error */
954 return NULL; 957 return NULL;
955 } 958 }
956 else 959 else
957 { 960 {
958 return result; 961 return result;
980 params.result = &result; 983 params.result = &result;
981 params.identifier = sopInstanceUID; 984 params.identifier = sopInstanceUID;
982 985
983 if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params)) 986 if (context->InvokeService(context, _OrthancPluginService_LookupInstance, &params))
984 { 987 {
988 /* Error */
985 return NULL; 989 return NULL;
986 } 990 }
987 else 991 else
988 { 992 {
989 return result; 993 return result;
1120 params.resultString = &result; 1124 params.resultString = &result;
1121 params.instance = instance; 1125 params.instance = instance;
1122 1126
1123 if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, &params)) 1127 if (context->InvokeService(context, _OrthancPluginService_GetInstanceRemoteAet, &params))
1124 { 1128 {
1129 /* Error */
1125 return NULL; 1130 return NULL;
1126 } 1131 }
1127 else 1132 else
1128 { 1133 {
1129 return result; 1134 return result;
1142 params.resultInt64 = &size; 1147 params.resultInt64 = &size;
1143 params.instance = instance; 1148 params.instance = instance;
1144 1149
1145 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, &params)) 1150 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSize, &params))
1146 { 1151 {
1152 /* Error */
1147 return -1; 1153 return -1;
1148 } 1154 }
1149 else 1155 else
1150 { 1156 {
1151 return size; 1157 return size;
1164 params.resultString = &result; 1170 params.resultString = &result;
1165 params.instance = instance; 1171 params.instance = instance;
1166 1172
1167 if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, &params)) 1173 if (context->InvokeService(context, _OrthancPluginService_GetInstanceData, &params))
1168 { 1174 {
1175 /* Error */
1169 return NULL; 1176 return NULL;
1170 } 1177 }
1171 else 1178 else
1172 { 1179 {
1173 return result; 1180 return result;
1186 params.resultStringToFree = &result; 1193 params.resultStringToFree = &result;
1187 params.instance = instance; 1194 params.instance = instance;
1188 1195
1189 if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, &params)) 1196 if (context->InvokeService(context, _OrthancPluginService_GetInstanceJson, &params))
1190 { 1197 {
1198 /* Error */
1191 return NULL; 1199 return NULL;
1192 } 1200 }
1193 else 1201 else
1194 { 1202 {
1195 return result; 1203 return result;
1208 params.resultStringToFree = &result; 1216 params.resultStringToFree = &result;
1209 params.instance = instance; 1217 params.instance = instance;
1210 1218
1211 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, &params)) 1219 if (context->InvokeService(context, _OrthancPluginService_GetInstanceSimplifiedJson, &params))
1212 { 1220 {
1221 /* Error */
1213 return NULL; 1222 return NULL;
1214 } 1223 }
1215 else 1224 else
1216 { 1225 {
1217 return result; 1226 return result;
1218 } 1227 }
1219 } 1228 }
1220 1229
1221 1230
1222 1231 ORTHANC_PLUGIN_INLINE int OrthancPluginHasInstanceMetadata(
1223 1232 OrthancPluginContext* context,
1224 /* 1233 OrthancPluginDicomInstance* instance,
1225 TODO : METADATA !!! 1234 const char* key)
1226 TODO : DOCUMENTATION !!! 1235 {
1227 */ 1236 int64_t result;
1237
1238 _OrthancPluginAccessDicomInstance params;
1239 memset(&params, 0, sizeof(params));
1240 params.resultInt64 = &result;
1241 params.instance = instance;
1242 params.key = key;
1243
1244 if (context->InvokeService(context, _OrthancPluginService_HasInstanceMetadata, &params))
1245 {
1246 /* Error */
1247 return -1;
1248 }
1249 else
1250 {
1251 return (result != 0);
1252 }
1253 }
1254
1255
1256 ORTHANC_PLUGIN_INLINE const char* OrthancPluginGetInstanceMetadata(
1257 OrthancPluginContext* context,
1258 OrthancPluginDicomInstance* instance,
1259 const char* key)
1260 {
1261 const char* result;
1262
1263 _OrthancPluginAccessDicomInstance params;
1264 memset(&params, 0, sizeof(params));
1265 params.resultString = &result;
1266 params.instance = instance;
1267 params.key = key;
1268
1269 if (context->InvokeService(context, _OrthancPluginService_GetInstanceMetadata, &params))
1270 {
1271 /* Error */
1272 return NULL;
1273 }
1274 else
1275 {
1276 return result;
1277 }
1278 }
1279
1228 1280
1229 1281
1230 #ifdef __cplusplus 1282 #ifdef __cplusplus
1231 } 1283 }
1232 #endif 1284 #endif