/// <summary> /// Initializes new Basic Image Box /// </summary> /// <param name="filmBox">Basic Film Box</param> /// <param name="sopClass">SOP Class UID</param> /// <param name="sopInstance">SOP Instance UID</param> public DcmImageBox(DcmFilmBox filmBox, DicomUID sopClass, DicomUID sopInstance) { _filmBox = filmBox; _sopClass = sopClass; _sopInstance = sopInstance; _dataset = new DcmDataset(DicomTransferSyntax.ImplicitVRLittleEndian); }
/// <summary> /// Initializes new Basic Image Box /// </summary> /// <param name="filmBox">Basic Film Box</param> /// <param name="sopClass">SOP Class UID</param> /// <param name="sopInstance">SOP Instance UID</param> /// <param name="dataset">Dataset</param> public DcmImageBox(DcmFilmBox filmBox, DicomUID sopClass, DicomUID sopInstance, DcmDataset dataset) { _filmBox = filmBox; _sopClass = sopClass; _sopInstance = sopInstance; _dataset = dataset; }
protected override void OnReceiveNDeleteResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedClass, DicomUID affectedInstance, DcmStatus status) { if (_filmSession != null) { if (affectedClass == DicomUID.BasicFilmBoxSOPClass) { if (status == DcmStatus.Success) { DcmFilmBox filmBox = _filmSession.FindFilmBox(affectedInstance); if (filmBox != null) { _pendingFilmBoxResponses.Remove(filmBox); if (_pendingFilmBoxResponses.Count == 0) { byte pcid = Associate.FindAbstractSyntax(DicomUID.PrinterSOPClass); SendNDeleteRequest(pcid, NextMessageID(), DicomUID.BasicFilmSessionSOPClass, _filmSession.SOPInstanceUID); } return; } } } if (affectedClass == DicomUID.BasicFilmSessionSOPClass) { if (status == DcmStatus.Success) { SendReleaseRequest(); return; } } } SendAbort(DcmAbortSource.ServiceUser, DcmAbortReason.NotSpecified); }
public DcmFilmBox Clone() { DcmFilmBox box = new DcmFilmBox(_session, SOPInstanceUID, Dataset.Clone()); foreach (DcmImageBox imageBox in BasicImageBoxes) { box.BasicImageBoxes.Add(imageBox.Clone()); } return(box); }
public DcmFilmBox CreateFilmBox(DicomUID sopInstance, DcmDataset dataset) { var uid = sopInstance; if (uid == null || uid.UID == String.Empty) { uid = DicomUID.Generate(SOPInstanceUID, _boxes.Count + 1); } var box = new DcmFilmBox(this, uid, dataset); _boxes.Add(box); return(box); }
protected override void OnReceiveNCreateResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedClass, DicomUID affectedInstance, DcmDataset dataset, DcmStatus status) { if (_filmSession != null) { if (affectedClass == DicomUID.BasicFilmSessionSOPClass) { if (status == DcmStatus.Success) { int filmBoxesCount = CalculateRequiredImageBoxes(); if (filmBoxesCount == 0) { SendReleaseRequest(); return; } for (int i = 0; i < filmBoxesCount; i++) { DicomUID uid = DicomUID.Generate(); DcmDataset filmBoxDataset = new DcmDataset(DicomTransferSyntax.ImplicitVRLittleEndian); DcmFilmBox filmBox = _filmSession.CreateFilmBox(uid, filmBoxDataset.Clone()); filmBox.AnnotationDisplayFormatID = _annotationDisplayFormatID; filmBox.BorderDensity = _borderDensity; filmBox.ConfigurationInformation = _configurationInformation; filmBox.EmptyImageDensity = _emptyImageDensity; filmBox.FilmOrientation = _filmOrientation; filmBox.FilmSizeID = _filmSizeID; filmBox.Illumination = _illumination; filmBox.ImageDisplayFormat = _imageDisplayFormat; filmBox.MagnificationType = _magnificationType; filmBox.MaxDensity = _maxDensity; filmBox.MinDensity = _minDensity; filmBox.ReflectedAmbientLight = _reflectedAmbientLight; filmBox.RequestedResolutionID = _requestedResolutionID; filmBox.SmoothingType = _smoothingType; filmBox.Trim = _trim; byte pcid = Associate.FindAbstractSyntax(DicomUID.BasicGrayscalePrintManagementMetaSOPClass); SendNCreateRequest(pcid, NextMessageID(), DicomUID.BasicFilmBoxSOPClass, filmBox.SOPInstanceUID, filmBox.Dataset); } return; } } if (affectedClass == DicomUID.BasicFilmBoxSOPClass) { if (status == DcmStatus.Success) { DcmFilmBox filmBox = _filmSession.FindFilmBox(affectedInstance); int filmBoxIndex = _filmSession.BasicFilmBoxes.IndexOf(filmBox); if (filmBox != null) { DcmItemSequence referencedImageBoxSequenceList = null; referencedImageBoxSequenceList = dataset.GetSQ(DicomTags.ReferencedImageBoxSequence); if (referencedImageBoxSequenceList != null) { foreach (DcmItemSequenceItem item in referencedImageBoxSequenceList.SequenceItems) { DicomUID referencedSOPInstanceUID = item.Dataset.GetUID(DicomTags.ReferencedSOPInstanceUID); if (referencedSOPInstanceUID != null) { DcmImageBox imageBox = new DcmImageBox(filmBox, DcmImageBox.GraySOPClassUID, referencedSOPInstanceUID); filmBox.BasicImageBoxes.Add(imageBox); } } } _pendingImageBoxResponses.Clear(); if (filmBox.BasicImageBoxes.Count > 0) { int imageBoxIndex = 0; int imagesPerFilmbox = CalculateImagesPreFilmBox(); foreach (DcmImageBox imageBox in filmBox.BasicImageBoxes) { if (imagesPerFilmbox * filmBoxIndex + imageBoxIndex < _files.Count) { UpdateImageBox(imageBox, _files[imagesPerFilmbox * filmBoxIndex + imageBoxIndex], imageBoxIndex); } _pendingImageBoxResponses.Add(imageBox); imageBoxIndex++; byte pcid = Associate.FindAbstractSyntax(DicomUID.PrinterSOPClass); SendNSetRequest(pcid, NextMessageID(), imageBox.SOPClassUID, imageBox.SOPInstanceUID, imageBox.Dataset); } } return; } } } } SendAbort(DcmAbortSource.ServiceUser, DcmAbortReason.NotSpecified); }
public DcmFilmBox CreateFilmBox(DicomUID sopInstance, DcmDataset dataset) { DicomUID uid = sopInstance; if (uid == null || uid.UID == String.Empty) uid = DicomUID.Generate(SOPInstanceUID, _boxes.Count + 1); DcmFilmBox box = new DcmFilmBox(this, uid, dataset); _boxes.Add(box); return box; }
public DcmFilmBox Clone() { DcmFilmBox box = new DcmFilmBox(_session, SOPInstanceUID, Dataset.Clone()); foreach (DcmImageBox imageBox in BasicImageBoxes) { box.BasicImageBoxes.Add(imageBox.Clone()); } return box; }