Beispiel #1
0
        private void ImportImages(string path)
        {
            // Import into the local storage
            var filePaths  = GetFiles(path).ToList();
            var dicomFiles = new List <DicomFile>();

            foreach (var tempAnnFileName in filePaths)
            {
                try
                {
                    var annFile = new DicomFile(tempAnnFileName);
                    annFile.Load(DicomReadOptions.Default | DicomReadOptions.DoNotStorePixelDataInDataSet);
                    dicomFiles.Add(annFile);
                    string studyInstanceUid = annFile.DataSet[DicomTags.StudyInstanceUid];
                    lock (_lock)
                    {
                        _studyUidsTempFolders.Add(studyInstanceUid, path);
                    }
                }
                catch (Exception ex)
                {
                    Platform.Log(LogLevel.Warn, ex, "Ignoring file for XNAT import: " + tempAnnFileName, tempAnnFileName);
                }
            }

            try
            {
                AimDicomFilePublisher.PublishLocal(dicomFiles);
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Error, ex, "Failed to store annotations");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Imports the given dicom files into the local storage
        /// </summary>
        /// <param name="dicomFiles"></param>
        protected void ImportDicomFiles(IEnumerable <string> fileNames)
        {
            var dicomFiles = new List <DicomFile>();

            // Import into the local storage
            foreach (var fileName in fileNames)
            {
                try
                {
                    var annFile = new DicomFile(fileName);
                    annFile.Load(DicomReadOptions.Default | DicomReadOptions.DoNotStorePixelDataInDataSet);
                    dicomFiles.Add(annFile);
                }
                catch (Exception ex)
                {
                    Platform.Log(LogLevel.Warn, ex, "Ignoring file for XNAT import: " + fileName, fileName);
                }
            }

            try
            {
                AimDicomFilePublisher.PublishLocal(dicomFiles);
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Error, ex, "Failed to store annotations");
                //this.DesktopWindow.ShowMessageBox("Failed to store your annotation(s).", "Annotation Import Error", MessageBoxActions.Ok);
            }
        }
Beispiel #3
0
            /// <summary>
            /// Imports the given dicom files into the local storage
            /// </summary>
            /// <param name="filePathNames">Complete paths of the files to load</param>
            protected void ImportDicomFiles(ICollection <string> filePathNames)
            {
                try
                {
                    var dicomFiles = new List <DicomFile>();
                    foreach (var filePathName in filePathNames)
                    {
                        var dicomFile = new DicomFile(filePathName);
                        dicomFile.Load();
                        dicomFiles.Add(dicomFile);
                    }

                    AimDicomFilePublisher.PublishLocal(dicomFiles);
                    //Platform.GetService((IPublishFiles w) => w.PublishLocal(dicomFiles));
                }
                catch (Exception e)
                {
                    Platform.Log(LogLevel.Error, e, "Failed to import Grid files into the local storage");
                    try
                    {
                        foreach (string file in filePathNames)
                        {
                            File.Delete(file);
                        }
                    }
                    catch (Exception ex)
                    {
                        Platform.Log(LogLevel.Error, ex, "Failed to remove temp Grid files");
                    }
                    throw;
                }
            }