/// <summary> /// Scan the files to send, and create presentation contexts for each abstract syntax to send. /// </summary> protected override void SetPresentationContexts() { byte pcid = AssociationParameters.FindAbstractSyntax(MoveSopClass); if (pcid == 0) { pcid = AssociationParameters.AddPresentationContext(MoveSopClass); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian); } }
/// <summary> /// Scan the files to send, and create presentation contexts for each abstract syntax to send. /// </summary> protected override void SetPresentationContexts() { byte pcid = AssociationParameters.AddPresentationContext(SopClass.StorageCommitmentPushModelSopClass); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian); pcid = AssociationParameters.AddPresentationContext(SopClass.MrImageStorage); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian); }
/// <summary> /// Adds the sop class to presentation context for Explicit and Implicit Vr Little Endian /// </summary> /// <param name="sopClass">The sop class.</param> /// <exception cref="DicomException"/> /// <exception cref="ArgumentNullException"/> protected void AddSopClassToPresentationContext(SopClass sopClass) { if (sopClass == null) { throw new ArgumentNullException("sopClass"); } byte pcid = AssociationParameters.FindAbstractSyntax(sopClass); if (pcid == 0) { pcid = AssociationParameters.AddPresentationContext(sopClass); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian); } else { throw new DicomException("Cannot find SopClass in association parameters: " + sopClass); } }
/// <summary> /// Scan the files to send, and create presentation contexts for each abstract syntax to send. /// </summary> protected override void SetPresentationContexts() { foreach (StorageInstance sendStruct in _storageInstanceList) { // skip if failed in LoadStorageInstanceInfo, ie file not found if (sendStruct.SendStatus == DicomStatuses.ProcessingFailure) { continue; } if (sendStruct.TransferSyntax.Encapsulated) { // If the image is encapsulated, make sure there's an exact match of the transfer // syntax, if not, just make sure there's an unencapsulated transfer syntax. byte pcid = AssociationParameters.FindAbstractSyntaxWithTransferSyntax(sendStruct.SopClass, sendStruct.TransferSyntax); if (pcid == 0) { pcid = AssociationParameters.AddPresentationContext(sendStruct.SopClass); AssociationParameters.AddTransferSyntax(pcid, sendStruct.TransferSyntax); } // Check for a codec, and if it exists, also register an uncompressed context. IDicomCodec codec = DicomCodecRegistry.GetCodec(sendStruct.TransferSyntax); if (codec != null) { pcid = AssociationParameters.FindAbstractSyntaxWithTransferSyntax(sendStruct.SopClass, TransferSyntax.ExplicitVrLittleEndian); if (pcid == 0) { pcid = AssociationParameters.AddPresentationContext(sendStruct.SopClass); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian); } } } else { byte pcid = AssociationParameters.FindAbstractSyntaxWithTransferSyntax(sendStruct.SopClass, TransferSyntax.ExplicitVrLittleEndian); if (pcid == 0) { pcid = AssociationParameters.AddPresentationContext(sendStruct.SopClass); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian); AssociationParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian); } } // Now add the preferred syntaxes, if its been set. if (_preferredSyntaxes != null) { SupportedSop supportedSop; if (_preferredSyntaxes.TryGetValue(sendStruct.SopClass.Uid, out supportedSop)) { foreach (TransferSyntax syntax in supportedSop.SyntaxList) { byte pcid = AssociationParameters.FindAbstractSyntaxWithTransferSyntax(sendStruct.SopClass, syntax); // If we have more than 1 transfer syntax associated with the preferred, we want to // have a dedicated presentation context for the preferred, so that we ensure it // gets accepted if the SCP supports it. This is only really going to happen if // the preferred is Explicit VR Little Endian or Implicit VR Little Endian. if ((pcid == 0) || (AssociationParameters.GetPresentationContextTransferSyntaxes(pcid).Count > 1)) { pcid = AssociationParameters.AddPresentationContext(sendStruct.SopClass); AssociationParameters.AddTransferSyntax(pcid, syntax); } } } } } }