Пример #1
0
        protected override DicomDataset GetMediaDataset(DicomDataset data, DicomMediaProperties mediaInfo)
        {
            if (mediaInfo.MediaType != MediaType)
            {
                throw new InvalidOperationException(string.Format("Invalid media type. Supported media type is:{0} and provided media type is:{1}",
                                                                  MediaType, mediaInfo.MediaType));
            }

            if (!string.IsNullOrWhiteSpace(mediaInfo.TransferSyntax) && mediaInfo.TransferSyntax != "*")
            {
                var transfer = DicomTransferSyntax.Parse(mediaInfo.TransferSyntax);

                if (transfer == data.InternalTransferSyntax)
                {
                    return(data);
                }

                var ds = data.Clone(transfer);

                ds.AddOrUpdate(DicomTag.TransferSyntaxUID, transfer.UID.UID);

                return(ds);
            }
            else
            {
                return(base.GetMediaDataset(data, mediaInfo));
            }
        }
Пример #2
0
 protected override void Upload
 (
     fo.DicomDataset dicomDataset,
     int frame,
     IStorageLocation location,
     DicomMediaProperties mediaProperties)
 {
     location.Upload(System.Text.Encoding.UTF8.GetBytes(Converter.Convert(dicomDataset)), MediaType);
 }
Пример #3
0
        protected override fo.DicomDataset GetMediaDataset(fo.DicomDataset data, DicomMediaProperties mediaInfo)
        {
            //TODO: this is still not working with when images BPP are not compatible from one Transfer to the other (12/16-bit -> 8-bit)
            if (!string.IsNullOrWhiteSpace(mediaInfo.TransferSyntax))
            {
                return(data.Clone(fo.DicomTransferSyntax.Parse(mediaInfo.TransferSyntax)));
            }
            else if (data.InternalTransferSyntax != fo.DicomTransferSyntax.JPEGProcess1)
            {
                return(data.Clone(fo.DicomTransferSyntax.JPEGProcess1));
            }

            return(base.GetMediaDataset(data, mediaInfo));
        }
Пример #4
0
        protected override fo.DicomDataset GetMediaDataset(fo.DicomDataset data, DicomMediaProperties mediaInfo)
        {
            if (mediaInfo.MediaType != MediaType)
            {
                throw new InvalidOperationException(string.Format("Invalid media type. Supported media type is:{0} and provided media type is:{1}",
                                                                  MediaType, mediaInfo.MediaType));
            }

            if (!string.IsNullOrWhiteSpace(mediaInfo.TransferSyntax))
            {
                return(data.Clone(fo.DicomTransferSyntax.Parse(mediaInfo.TransferSyntax)));
            }

            return(base.GetMediaDataset(data, mediaInfo));
        }
Пример #5
0
        protected override void Upload
        (
            DicomDataset dicomDataset,
            int frame,
            IStorageLocation location,
            DicomMediaProperties mediaProperties
        )
        {
            DicomFile df = new DicomFile(dicomDataset);


            using (Stream stream = new MemoryStream())
            {
                df.Save(stream);
                stream.Position = 0;

                location.Upload(stream, MediaType);
            }
        }
Пример #6
0
        protected override void Upload
        (
            fo.DicomDataset dicomObject,
            int frame,
            IStorageLocation storeLocation,
            DicomMediaProperties mediaProperties
        )
        {
            var frameIndex = frame - 1;
            var dicomImage = new DicomImage(dicomObject, frameIndex);
            var bitmap     = dicomImage.RenderImage(frameIndex).AsBitmap();
            var stream     = new MemoryStream( );

            bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);

            stream.Position = 0;

            storeLocation.Upload(stream, MediaType);
        }
Пример #7
0
 public DicomMediaId(IObjectId objectId, DicomMediaProperties mediaInfo)
 {
     Init(objectId, mediaInfo.MediaType, GetTransferSyntax(mediaInfo.TransferSyntax));
 }
Пример #8
0
 protected override fo.DicomDataset GetMediaDataset(fo.DicomDataset data, DicomMediaProperties mediaInfo)
 {
     return(base.GetMediaDataset(data, mediaInfo));
 }
Пример #9
0
 protected virtual fo.DicomDataset GetMediaDataset(fo.DicomDataset data, DicomMediaProperties mediaInfo)
 {
     return(data);
 }
Пример #10
0
 protected abstract void Upload(fo.DicomDataset dataset, int frame, IStorageLocation storeLocation, DicomMediaProperties mediaProperties);
Пример #11
0
        protected override void Upload(fo.DicomDataset dicomDataset, int frame, IStorageLocation storeLocation, DicomMediaProperties mediaProperties)
        {
            var uncompressedData = new UncompressedPixelDataWrapper(dicomDataset);
            var buffer           = uncompressedData.PixelData.GetFrame(frame - 1);
            var data             = new byte[0];


            try
            {
                //TODO: check fo-dicom, dicom file with no data will throw an exception althoug
                //it is wrapped with a RangeByteBuffer but Internal is EmptyBuffer
                //only way to find out is to ignore exception
                data = buffer.Data;
            }
            catch {}

            storeLocation.Upload(data, MediaType);
        }
Пример #12
0
 public virtual IMediaId Create(IObjectId objectId, DicomMediaProperties mediaInfo)
 {
     return(new DicomMediaId(objectId, mediaInfo));
 }