public async Task GivenStoredDicomFileWithNoContent_WhenRetrieved_TheFileIsRetrievedCorrectly()
        {
            var       studyInstanceUid = TestUidGenerator.Generate();
            DicomFile dicomFile1       = Samples.CreateRandomDicomFile(studyInstanceUid);
            var       dicomInstance    = dicomFile1.Dataset.ToInstanceIdentifier();
            DicomWebResponse <DicomDataset> response = await _client.StoreAsync(new[] { dicomFile1 }, studyInstanceUid);

            DicomSequence successSequence = response.Value.GetSequence(DicomTag.ReferencedSOPSequence);

            string studyRetrieveLocation    = response.Value.GetSingleValue <string>(DicomTag.RetrieveURL);
            string instanceRetrieveLocation = successSequence.Items[0].GetSingleValue <string>(DicomTag.RetrieveURL);

            DicomWebResponse <IReadOnlyList <DicomFile> > studyByUrlRetrieve = await _client.RetrieveInstancesAsync(new Uri(studyRetrieveLocation));

            ValidateRetrieveTransaction(studyByUrlRetrieve, HttpStatusCode.OK, DicomTransferSyntax.ExplicitVRLittleEndian, singleInstance: false, dicomFile1);

            DicomWebResponse <IReadOnlyList <DicomFile> > instanceByUrlRetrieve = await _client.RetrieveInstancesAsync(new Uri(instanceRetrieveLocation), true);

            ValidateRetrieveTransaction(instanceByUrlRetrieve, HttpStatusCode.OK, DicomTransferSyntax.ExplicitVRLittleEndian, singleInstance: true, dicomFile1);

            DicomWebResponse <IReadOnlyList <DicomFile> > studyRetrieve = await _client.RetrieveStudyAsync(dicomInstance.StudyInstanceUid);

            ValidateRetrieveTransaction(studyRetrieve, HttpStatusCode.OK, DicomTransferSyntax.ExplicitVRLittleEndian, singleInstance: false, dicomFile1);

            DicomWebResponse <IReadOnlyList <DicomFile> > seriesRetrieve = await _client.RetrieveSeriesAsync(dicomInstance.StudyInstanceUid, dicomInstance.SeriesInstanceUid);

            ValidateRetrieveTransaction(seriesRetrieve, HttpStatusCode.OK, DicomTransferSyntax.ExplicitVRLittleEndian, singleInstance: false, dicomFile1);

            DicomWebResponse <IReadOnlyList <DicomFile> > instanceRetrieve = await _client.RetrieveInstanceAsync(dicomInstance.StudyInstanceUid, dicomInstance.SeriesInstanceUid, dicomInstance.SopInstanceUid);

            ValidateRetrieveTransaction(instanceRetrieve, HttpStatusCode.OK, DicomTransferSyntax.ExplicitVRLittleEndian, singleInstance: true, dicomFile1);
        }
Exemple #2
0
        public static async Task <DicomWebAsyncEnumerableResponse <DicomFile> > RetrieveStudyAsync(
            this IDicomWebClient dicomWebClient,
            string studyInstanceUid,
            string dicomTransferSyntax          = DicomWebConstants.OriginalDicomTransferSyntax,
            CancellationToken cancellationToken = default)
        {
            EnsureArg.IsNotNull(dicomWebClient, nameof(dicomWebClient));

            return(await dicomWebClient.RetrieveInstancesAsync(
                       new Uri(string.Format(DicomWebConstants.BaseStudyUriFormat, studyInstanceUid), UriKind.Relative),
                       dicomTransferSyntax,
                       cancellationToken).ConfigureAwait(false));
        }
        public static Task <DicomWebResponse <IReadOnlyList <DicomFile> > > RetrieveStudyAsync(
            this IDicomWebClient dicomWebClient,
            string studyInstanceUid,
            string dicomTransferSyntax          = DicomWebConstants.OriginalDicomTransferSyntax,
            CancellationToken cancellationToken = default)
        {
            EnsureArg.IsNotNull(dicomWebClient, nameof(dicomWebClient));

            return(dicomWebClient.RetrieveInstancesAsync(
                       new Uri(string.Format(DicomWebConstants.BaseStudyUriFormat, studyInstanceUid), UriKind.Relative),
                       false,
                       dicomTransferSyntax,
                       cancellationToken));
        }