/// <summary> /// Initializes a new instance of <see cref="ImageGraphic"/> /// with the specified image parameters. /// </summary> /// <param name="rows"></param> /// <param name="columns"></param> /// <param name="bitsPerPixel">Can be 8 or 16 in the case of /// grayscale images, or 32 for multichannel colour images.</param> /// <param name="pixelData"></param> /// <remarks> /// Creates an image using existing pixel data. /// </remarks> /// <exception cref="NullReferenceException"><paramref name="pixelData"/> is <b>null</b></exception> /// <exception cref="ArgumentException"><paramref name="rows"/> or /// <paramref name="columns"/> is negative, or <paramref name="bitsPerPixel"/> /// is not one of 8, 16 or 32.</exception> protected ImageGraphic(int rows, int columns, int bitsPerPixel, byte[] pixelData) { Platform.CheckForNullReference(pixelData, "pixelData"); DicomValidator.ValidatePixelData(pixelData, rows, columns, bitsPerPixel); _pixelDataRaw = pixelData; Initialize(rows, columns, bitsPerPixel); }
public void Validate(DicomFile dicomFile) { DicomAttributeCollection sopInstanceDataset = dicomFile.DataSet; DicomAttributeCollection metaInfo = dicomFile.MetaInfo; DicomAttribute attribute = metaInfo[DicomTags.MediaStorageSopClassUid]; // we want to skip Media Storage Directory Storage (DICOMDIR directories) if ("1.2.840.10008.1.3.10" == attribute.ToString()) { throw new DataStoreException("Cannot process dicom directory files."); } DicomValidator.ValidateStudyInstanceUID(sopInstanceDataset[DicomTags.StudyInstanceUid]); DicomValidator.ValidateSeriesInstanceUID(sopInstanceDataset[DicomTags.SeriesInstanceUid]); DicomValidator.ValidateSOPInstanceUID(sopInstanceDataset[DicomTags.SopInstanceUid]); DicomValidator.ValidateTransferSyntaxUID(metaInfo[DicomTags.TransferSyntaxUid]); if (dicomFile.SopClass == null) { throw new DataStoreException("The sop class must not be empty."); } DicomValidator.ValidateSopClassUid(dicomFile.SopClass.Uid); Study study = new Study(); study.Initialize(dicomFile); _validator.ValidatePersistentObject(study); }
private void Initialize(int rows, int columns, int bitsPerPixel) { DicomValidator.ValidateRows(rows); DicomValidator.ValidateColumns(columns); _rows = rows; _columns = columns; _bitsPerPixel = bitsPerPixel; SetValidationPolicy(); }
private void Initialize(int rows, int columns, int bitsAllocated) { DicomValidator.ValidateRows(rows); DicomValidator.ValidateColumns(columns); _rows = rows; _columns = columns; _bitsAllocated = bitsAllocated; _bytesPerPixel = bitsAllocated / 8; _stride = _columns * _bytesPerPixel; }
/// <summary> /// Validates the <see cref="Sop"/> object. /// </summary> /// <remarks> /// Derived classes should call the base class implementation first, and then do further validation. /// The <see cref="Sop"/> class validates properties deemed vital to usage of the object. /// </remarks> /// <exception cref="SopValidationException">Thrown when validation fails.</exception> protected virtual void ValidateInternal() { if (ValidationSettings.Default.DisableSopValidation) { return; } DicomValidator.ValidateSOPInstanceUID(this.SopInstanceUid); DicomValidator.ValidateSeriesInstanceUID(this.SeriesInstanceUid); DicomValidator.ValidateStudyInstanceUID(this.StudyInstanceUid); }
private void Initialize(int bitsStored, int highBit, bool isSigned) { DicomValidator.ValidateBitsStored(bitsStored); DicomValidator.ValidateHighBit(highBit); _bitsStored = bitsStored; _highBit = highBit; _isSigned = isSigned; CalculateAbsolutePixelValueRange(); }
/// <summary> /// Validates the <see cref="Sop"/> object. /// </summary> /// <remarks> /// Derived classes should call the base class implementation first, and then do further validation. /// The <see cref="Sop"/> class validates properties deemed vital to usage of the object. /// </remarks> /// <exception cref="SopValidationException">Thrown when validation fails.</exception> protected virtual void ValidateInternal() { if (_disableSopValidation) { return; } DicomValidator.ValidateSOPInstanceUID(SopInstanceUid, false); DicomValidator.ValidateSeriesInstanceUID(SeriesInstanceUid, false); DicomValidator.ValidateStudyInstanceUID(StudyInstanceUid, false); }
/// <summary> /// Initializes a new instance of <see cref="ModalityLutLinear"/> with the specified parameters. /// </summary> /// <param name="bitsStored">Indicates the number of bits stored of the associated pixel data.</param> /// <param name="isSigned">Indicates whether or not the associated pixel data is signed.</param> /// <param name="rescaleSlope">The rescale slope.</param> /// <param name="rescaleIntercept">The rescale intercept.</param> public ModalityLutLinear( int bitsStored, bool isSigned, double rescaleSlope, double rescaleIntercept) : base() { DicomValidator.ValidateBitsStored(bitsStored); _bitsStored = bitsStored; _isSigned = isSigned; this.RescaleSlope = rescaleSlope; this.RescaleIntercept = rescaleIntercept; Initialize(); }
private void Initialize( int bitsStored, int highBit, bool isSigned, double rescaleSlope, double rescaleIntercept, bool invert) { DicomValidator.ValidateBitsStored(bitsStored); DicomValidator.ValidateHighBit(highBit); _bitsStored = bitsStored; _highBit = highBit; _isSigned = isSigned; _rescaleSlope = rescaleSlope <= double.Epsilon ? 1 : rescaleSlope; _rescaleIntercept = rescaleIntercept; DefaultInvert = Invert = invert; }
/// <summary> /// Validates the <see cref="ImageSop"/> object. /// </summary> /// <remarks> /// Derived classes should call the base class implementation first, and then do further validation. /// The <see cref="ImageSop"/> class validates properties deemed vital to usage of the object. /// </remarks> /// <exception cref="SopValidationException">Thrown when validation fails.</exception> internal void Validate() { DicomValidator.ValidateRows(this.Rows); DicomValidator.ValidateColumns(this.Columns); DicomValidator.ValidateBitsAllocated(this.BitsAllocated); DicomValidator.ValidateBitsStored(this.BitsStored); DicomValidator.ValidateHighBit(this.HighBit); DicomValidator.ValidateSamplesPerPixel(this.SamplesPerPixel); DicomValidator.ValidatePixelRepresentation(this.PixelRepresentation); DicomValidator.ValidatePhotometricInterpretation(this.PhotometricInterpretation); DicomValidator.ValidateImagePropertyRelationships ( this.BitsStored, this.BitsAllocated, this.HighBit, this.PhotometricInterpretation, this.PlanarConfiguration, this.SamplesPerPixel ); }
/// <summary> /// Validates the <see cref="ImageSop"/> object. /// </summary> /// <remarks> /// Derived classes should call the base class implementation first, and then do further validation. /// The <see cref="ImageSop"/> class validates properties deemed vital to usage of the object. /// </remarks> /// <exception cref="SopValidationException">Thrown when validation fails.</exception> internal void Validate() { DicomValidator.ValidateRows(Rows); DicomValidator.ValidateColumns(Columns); DicomValidator.ValidateBitsAllocated(BitsAllocated); DicomValidator.ValidateBitsStored(BitsStored); DicomValidator.ValidateHighBit(HighBit); DicomValidator.ValidateSamplesPerPixel(SamplesPerPixel); DicomValidator.ValidatePixelRepresentation(PixelRepresentation); DicomValidator.ValidatePhotometricInterpretation(PhotometricInterpretation); DicomValidator.ValidateImagePropertyRelationships ( BitsStored, BitsAllocated, HighBit, PhotometricInterpretation, PlanarConfiguration, SamplesPerPixel ); }