Beispiel #1
0
        /// <summary>
        /// Read properties from the given DicomDataset, throwing if Type 1 parameters are not present.
        /// </summary>
        /// <param name="ds"></param>
        /// <returns></returns>
        public static DicomCommonImage Read(DicomDataset ds)
        {
            var sopCommon = DicomSOPCommon.Read(ds);
            //throw
            // Changed for new OSS fo-dicom-desktop
            var position     = ds.GetValues <double>(DicomTag.ImagePositionPatient);
            var pixelSpacing = ds.GetValues <double>(DicomTag.PixelSpacing);
            var rows         = ds.GetSingleValue <int>(DicomTag.Rows);
            var columns      = ds.GetSingleValue <int>(DicomTag.Columns);
            var imageType    = ds.GetValues <string>(DicomTag.ImageType);
            //var position = ds.Get<double[]>(DicomTag.ImagePositionPatient);
            //var pixelSpacing = ds.Get<double[]>(DicomTag.PixelSpacing);
            //var rows = ds.Get<int>(DicomTag.Rows);
            //var columns = ds.Get<int>(DicomTag.Columns);
            //var imageType = ds.Get<string[]>(DicomTag.ImageType);
            var pPosition = new Point3D(position);
            // Note that DICOM encodes this as (Y,X)!!!
            var pSpacing = new Point2D(pixelSpacing[1], pixelSpacing[0]);

            // no throw
            // Changed for new OSS fo-dicom-desktop
            var location     = ds.GetSingleValueOrDefault <double>(DicomTag.SliceLocation, 0d);
            var windowCenter = ds.GetSingleValueOrDefault <double>(DicomTag.WindowCenter, 0d);
            var windowWidth  = ds.GetSingleValueOrDefault <double>(DicomTag.WindowWidth, 0d);

            //var location = ds.Get(DicomTag.SliceLocation, 0d);
            //var windowCenter = ds.Get(DicomTag.WindowCenter, 0d);
            //var windowWidth = ds.Get(DicomTag.WindowWidth, 0d);

            return(new DicomCommonImage(sopCommon, pPosition, pSpacing, location, imageType, rows, columns, windowCenter, windowWidth));
        }
Beispiel #2
0
 private DicomCommonImage(
     DicomSOPCommon sopCommon, Point3D ipp, Point2D pixelSpacing, double location, IReadOnlyList <string> imageType, int rows, int columns, double wCenter, double wWidth
     )
 {
     SopCommon            = sopCommon;
     ImagePositionPatient = ipp;
     PixelSpacing         = pixelSpacing;
     SliceLocation        = location;
     ImageType            = imageType;
     Rows         = rows;
     Columns      = columns;
     WindowCenter = wCenter;
     WindowWidth  = wWidth;
 }
Beispiel #3
0
 /// <summary>
 /// Create a reference to the given SOP common instance.
 /// </summary>
 /// <param name="instance"></param>
 /// <returns></returns>
 public static DicomRTContourImageItem Reference(DicomSOPCommon instance)
 {
     return(new DicomRTContourImageItem(instance.SopClassUid, instance.SopInstanceUid));
 }
Beispiel #4
0
 /// <summary>
 /// Returns an empty DicomCommonImage instance.
 /// </summary>
 /// <returns></returns>
 public static DicomCommonImage CreateEmpty()
 {
     return(new DicomCommonImage(
                DicomSOPCommon.CreateEmpty(), new Point3D(), new Point2D(), 0, new string[0], 0, 0, 0, 0));
 }