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); }