Mercurial > hg > orthanc
comparison Plugins/OrthancCPlugin/OrthancCPlugin.h @ 1037:6208ab500ffd
LookupResource service in plugin SDK
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 16 Jul 2014 14:29:37 +0200 |
parents | ab6a51f075fd |
children | 5a5a4890ffca |
comparison
equal
deleted
inserted
replaced
1036:bd17030db6d4 | 1037:6208ab500ffd |
---|---|
218 /* Access to the Orthanc database and API */ | 218 /* Access to the Orthanc database and API */ |
219 _OrthancPluginService_GetDicomForInstance = 3000, | 219 _OrthancPluginService_GetDicomForInstance = 3000, |
220 _OrthancPluginService_RestApiGet = 3001, | 220 _OrthancPluginService_RestApiGet = 3001, |
221 _OrthancPluginService_RestApiPost = 3002, | 221 _OrthancPluginService_RestApiPost = 3002, |
222 _OrthancPluginService_RestApiDelete = 3003, | 222 _OrthancPluginService_RestApiDelete = 3003, |
223 _OrthancPluginService_RestApiPut = 3004 | 223 _OrthancPluginService_RestApiPut = 3004, |
224 _OrthancPluginService_LookupPatient = 3005, | |
225 _OrthancPluginService_LookupStudy = 3006, | |
226 _OrthancPluginService_LookupSeries = 3007, | |
227 _OrthancPluginService_LookupInstance = 3008 | |
224 } _OrthancPluginService; | 228 } _OrthancPluginService; |
225 | 229 |
226 | 230 |
227 | 231 |
228 /** | 232 /** |
335 **/ | 339 **/ |
336 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString( | 340 ORTHANC_PLUGIN_INLINE void OrthancPluginFreeString( |
337 OrthancPluginContext* context, | 341 OrthancPluginContext* context, |
338 char* str) | 342 char* str) |
339 { | 343 { |
340 context->Free(str); | 344 if (str != NULL) |
345 { | |
346 context->Free(str); | |
347 } | |
341 } | 348 } |
342 | 349 |
343 | 350 |
344 /** | 351 /** |
345 * @brief Free a memory buffer. | 352 * @brief Free a memory buffer. |
691 params.redirection = redirection; | 698 params.redirection = redirection; |
692 context->InvokeService(context, _OrthancPluginService_Redirect, ¶ms); | 699 context->InvokeService(context, _OrthancPluginService_Redirect, ¶ms); |
693 } | 700 } |
694 | 701 |
695 | 702 |
703 | |
704 typedef struct | |
705 { | |
706 char** result; | |
707 const char* identifier; | |
708 } _OrthancPluginLookupResource; | |
709 | |
710 /** | |
711 * @brief Look for a patient. | |
712 * | |
713 * Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020). | |
714 * | |
715 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). | |
716 * @param patientID The Patient ID of interest. | |
717 * @return The NULL string if the patient is non-existent, or a string containing the | |
718 * Orthanc ID of the patient. This string must be freed by OrthancPluginFreeString(). | |
719 **/ | |
720 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupPatient( | |
721 OrthancPluginContext* context, | |
722 const char* patientID) | |
723 { | |
724 char* result; | |
725 | |
726 _OrthancPluginLookupResource params; | |
727 params.result = &result; | |
728 params.identifier = patientID; | |
729 | |
730 if (context->InvokeService(context, _OrthancPluginService_LookupPatient, ¶ms)) | |
731 { | |
732 return NULL; | |
733 } | |
734 else | |
735 { | |
736 return result; | |
737 } | |
738 } | |
739 | |
740 | |
741 /** | |
742 * @brief Look for a study. | |
743 * | |
744 * Look for a study stored in Orthanc, using its Study Instance UID tag (0x0020, 0x000d). | |
745 * | |
746 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). | |
747 * @param studyUID The Study Instance UID of interest. | |
748 * @return The NULL string if the study is non-existent, or a string containing the | |
749 * Orthanc ID of the study. This string must be freed by OrthancPluginFreeString(). | |
750 **/ | |
751 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupStudy( | |
752 OrthancPluginContext* context, | |
753 const char* studyUID) | |
754 { | |
755 char* result; | |
756 | |
757 _OrthancPluginLookupResource params; | |
758 params.result = &result; | |
759 params.identifier = studyUID; | |
760 | |
761 if (context->InvokeService(context, _OrthancPluginService_LookupStudy, ¶ms)) | |
762 { | |
763 return NULL; | |
764 } | |
765 else | |
766 { | |
767 return result; | |
768 } | |
769 } | |
770 | |
771 | |
772 /** | |
773 * @brief Look for a series. | |
774 * | |
775 * Look for a series stored in Orthanc, using its Series Instance UID tag (0x0020, 0x000e). | |
776 * | |
777 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). | |
778 * @param seriesUID The Series Instance UID of interest. | |
779 * @return The NULL string if the series is non-existent, or a string containing the | |
780 * Orthanc ID of the series. This string must be freed by OrthancPluginFreeString(). | |
781 **/ | |
782 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupSeries( | |
783 OrthancPluginContext* context, | |
784 const char* seriesUID) | |
785 { | |
786 char* result; | |
787 | |
788 _OrthancPluginLookupResource params; | |
789 params.result = &result; | |
790 params.identifier = seriesUID; | |
791 | |
792 if (context->InvokeService(context, _OrthancPluginService_LookupSeries, ¶ms)) | |
793 { | |
794 return NULL; | |
795 } | |
796 else | |
797 { | |
798 return result; | |
799 } | |
800 } | |
801 | |
802 | |
803 /** | |
804 * @brief Look for an instance. | |
805 * | |
806 * Look for an instance stored in Orthanc, using its SOP Instance UID tag (0x0008, 0x0018). | |
807 * | |
808 * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). | |
809 * @param sopInstanceUID The SOP Instance UID of interest. | |
810 * @return The NULL string if the instance is non-existent, or a string containing the | |
811 * Orthanc ID of the instance. This string must be freed by OrthancPluginFreeString(). | |
812 **/ | |
813 ORTHANC_PLUGIN_INLINE char* OrthancPluginLookupInstance( | |
814 OrthancPluginContext* context, | |
815 const char* sopInstanceUID) | |
816 { | |
817 char* result; | |
818 | |
819 _OrthancPluginLookupResource params; | |
820 params.result = &result; | |
821 params.identifier = sopInstanceUID; | |
822 | |
823 if (context->InvokeService(context, _OrthancPluginService_LookupInstance, ¶ms)) | |
824 { | |
825 return NULL; | |
826 } | |
827 else | |
828 { | |
829 return result; | |
830 } | |
831 } | |
832 | |
833 | |
696 #ifdef __cplusplus | 834 #ifdef __cplusplus |
697 } | 835 } |
698 #endif | 836 #endif |
699 | 837 |
700 | 838 |