Esempio n. 1
0
        public void Pacs_Storage_Images( )
        {
            EnsureCodecsLoaded( );

            StoreService.StoreDicom(DicomHelper.GetDicomDataset(2), new DataAccess.InstanceMetadata( ));

            int counter = 0;

            foreach (string file in Directory.GetFiles(DicomHelpers.GetSampleImagesFolder( )))
            {
                var dataset = fo.DicomFile.Open(file).Dataset;

                //reason is to shorten the path where the DS is stored.
                //location include the UIDs, so make sure your storage
                // folder is close to the root when keeping the original UIDs
                dataset.AddOrUpdate(fo.DicomTag.PatientID, "Patient_" + counter);
                dataset.AddOrUpdate(fo.DicomTag.StudyInstanceUID, "Study_" + counter);
                dataset.AddOrUpdate(fo.DicomTag.SeriesInstanceUID, "Series_" + counter);
                dataset.AddOrUpdate(fo.DicomTag.SOPInstanceUID, "Instance_" + counter);

                StoreService.StoreDicom(dataset, new DataAccess.InstanceMetadata( ));

                counter++;
            }
        }
Esempio n. 2
0
        public void Pacs_Storage_Simple( )
        {
            StoreService.StoreDicom(DicomHelper.GetDicomDataset(0), new DataAccess.InstanceMetadata( ));
            StoreService.StoreDicom(DicomHelper.GetDicomDataset(1), new DataAccess.InstanceMetadata( ));
            StoreService.StoreDicom(DicomHelper.GetDicomDataset(2), new DataAccess.InstanceMetadata( ));

            Pacs_Delete_Simple( );
        }
        public void Pacs_Storage_Simple( )
        {
            Assert.AreEqual(StoreService.StoreDicom(DicomHelper.GetDicomDataset(0), new DataAccess.InstanceMetadata( )).Status, CommandStatus.Success);
            Assert.AreEqual(StoreService.StoreDicom(DicomHelper.GetDicomDataset(1), new DataAccess.InstanceMetadata( )).Status, CommandStatus.Success);
            Assert.AreEqual(StoreService.StoreDicom(DicomHelper.GetDicomDataset(2), new DataAccess.InstanceMetadata( )).Status, CommandStatus.Success);

            Pacs_Delete_Simple( );
        }
Esempio n. 4
0
        public void Pacs_Storage_Simple( )
        {
            StoreService.StoreDicom(DicomHelper.GetDicomDataset(0), new DataAccess.InstanceMetadata( ));
            StoreService.StoreDicom(DicomHelper.GetDicomDataset(1), new DataAccess.InstanceMetadata( ));
            StoreService.StoreDicom(DicomHelper.GetDicomDataset(2), new DataAccess.InstanceMetadata( ));

            // TODO: do a query and compare fields values.

            Pacs_Delete_Simple( );
        }
Esempio n. 5
0
        public async Task Web_Storage_Simple( )
        {
            DicomDataset[] storeDs = new DicomDataset[]
            {
                DicomHelper.GetDicomDataset(0),
                DicomHelper.GetDicomDataset(1),
                DicomHelper.GetDicomDataset(2)
            };

            var             request         = new HttpRequestMessage();
            WebStoreRequest webStoreRequest = new WebStoreRequest(request);

            request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(MimeMediaTypes.Json));

            webStoreRequest.MediaType = MimeMediaTypes.DICOM;

            var mimeType     = "application/dicom";
            var multiContent = new MultipartContent("related", "DICOM DATA BOUNDARY");

            multiContent.Headers.ContentType.Parameters.Add(new System.Net.Http.Headers.NameValueHeaderValue("type", "\"" + mimeType + "\""));

            foreach (var ds in storeDs)
            {
                DicomFile    dicomFile = new DicomFile(ds);
                MemoryStream ms        = new MemoryStream();

                dicomFile.Save(ms);
                ms.Position = 0;

                StreamContent sContent = new StreamContent(ms);

                sContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(mimeType);

                multiContent.Add(sContent);
                webStoreRequest.Request.Content = multiContent;
                webStoreRequest.Contents.Add(sContent);
            }

            var storeResult = await WebStoreService.Store(webStoreRequest);

            Assert.IsNotNull(storeResult);
            Assert.IsTrue(storeResult.IsSuccessStatusCode);

            ValidateStoredMatchQuery(storeDs);

            Pacs_Delete_Simple( );
        }
Esempio n. 6
0
        public void Pacs_Storage_Simple( )
        {
            DicomDataset[] storeDs = new DicomDataset[]
            {
                DicomHelper.GetDicomDataset(0),
                DicomHelper.GetDicomDataset(1),
                DicomHelper.GetDicomDataset(2)
            };

            StoreService.StoreDicom(storeDs[0], new DataAccess.InstanceMetadata( ));
            StoreService.StoreDicom(storeDs[1], new DataAccess.InstanceMetadata( ));
            StoreService.StoreDicom(storeDs[2], new DataAccess.InstanceMetadata( ));

            ValidateStoredMatchQuery(storeDs);

            Pacs_Delete_Simple( );
        }
Esempio n. 7
0
        private void PopulateData()
        {
            var templateDS = DicomHelper.GetDicomDataset(0);
            var modalities = new string[] { "CT", "MR", "XA" };

            for (int studyIndex = 0; studyIndex < TotalNumberOfStudies; studyIndex++)
            {
                var studyDs = new DicomDataset( );


                templateDS.CopyTo(studyDs);

                studyDs.AddOrUpdate(DicomTag.StudyInstanceUID, string.Format("std.{0}", studyIndex));

                for (int seriesIndex = 0; seriesIndex < NumberOfSeriesInStudy; seriesIndex++)
                {
                    var seriesDs = new DicomDataset( );


                    studyDs.CopyTo(seriesDs);

                    seriesDs.AddOrUpdate(DicomTag.SeriesInstanceUID, string.Format("std.{0}.ser.{1}", studyIndex, seriesIndex));
                    seriesDs.AddOrUpdate(DicomTag.Modality, modalities[studyIndex % modalities.Length]);

                    for (int instanceIndex = 0; instanceIndex < NumberOfInstancesInSeries; instanceIndex++)
                    {
                        var instanceDs = new DicomDataset( );


                        seriesDs.CopyTo(instanceDs);

                        instanceDs.AddOrUpdate(DicomTag.SOPInstanceUID, string.Format("std.{0}.ser.{1}.inst.{2}", studyIndex, seriesIndex, instanceIndex));

                        StoreService.StoreDicom(instanceDs, new DataAccess.InstanceMetadata());
                    }
                }
            }
        }