Example #1
0
        /// <summary>
        /// Reconstruct the main DICOM tags.
        /// This function requests the Orthanc core to reconstruct the main DICOM tags of all the resources of the given type.
        /// This function can only be used as a part of the upgrade of a custom database back-end.
        /// (cf. OrthancPlugins::IDatabaseBackend::UpgradeDatabase).
        /// A database transaction will be automatically setup.
        /// </summary>
        /// <param name="context">OrthancPluginContext* - The Orthanc plugin context, as received by OrthancPluginInitialize().</param>
        /// <param name="storageArea">OrthancPluginStorageArea* - The storage area.</param>
        /// <param name="level">OrthancPluginResourceType - The type of the resources of interest.</param>
        /// <returns>0 if success, other value if error.</returns>
        public static OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags(ref OrthancPluginContext context, IntPtr storageArea, OrthancPluginResourceType level)
        {
            IntPtr ptr = IntPtr.Zero;

            try
            {
                _OrthancPluginReconstructMainDicomTags pr = new _OrthancPluginReconstructMainDicomTags();
                pr.level       = level;
                pr.storageArea = storageArea;

                int size = Marshal.SizeOf(pr);
                ptr = Marshal.AllocHGlobal(size);
                Marshal.StructureToPtr(pr, ptr, true);

                return(context.InvokeService(ref context, _OrthancPluginService._OrthancPluginService_ReconstructMainDicomTags, ptr));
            }
            catch (Exception ex)
            {
                Log.Message(ex.ToString());
                OrthancPluginLogError(ref context, ex.ToString());
                return(OrthancPluginErrorCode.OrthancPluginErrorCode_InternalError);
            }
            finally
            {
                Marshal.FreeHGlobal(ptr);
            }
        }
        /// <summary>
        /// Reconstruct the main DICOM tags.
        /// This function requests the Orthanc core to reconstruct the main DICOM tags of all the resources of the given type.
        /// This function can only be used as a part of the upgrade of a custom database back-end.
        /// (cf. OrthancPlugins::IDatabaseBackend::UpgradeDatabase).
        /// A database transaction will be automatically setup.
        /// </summary>
        /// <param name="context">OrthancPluginContext* - The Orthanc plugin context, as received by OrthancPluginInitialize().</param>
        /// <param name="storageArea">OrthancPluginStorageArea* - The storage area.</param>
        /// <param name="level">OrthancPluginResourceType - The type of the resources of interest.</param>
        /// <returns>0 if success, other value if error.</returns>
        public static OrthancPluginErrorCode OrthancPluginReconstructMainDicomTags(ref OrthancPluginContext context, IntPtr storageArea, OrthancPluginResourceType level)
        {
            IntPtr ptr = IntPtr.Zero;
            try
            {
                _OrthancPluginReconstructMainDicomTags pr = new _OrthancPluginReconstructMainDicomTags();
                pr.level = level;
                pr.storageArea = storageArea;

                int size = Marshal.SizeOf(pr);
                ptr = Marshal.AllocHGlobal(size);
                Marshal.StructureToPtr(pr, ptr, true);

                return context.InvokeService(ref context, _OrthancPluginService._OrthancPluginService_ReconstructMainDicomTags, ptr);
            }
            catch (Exception ex)
            {
                Log.Message(ex.ToString());
                OrthancPluginLogError(ref context, ex.ToString());
                return OrthancPluginErrorCode.OrthancPluginErrorCode_InternalError;
            }
            finally
            {
                Marshal.FreeHGlobal(ptr);
            }
        }