Sends a C-MOVE-REQ message to a peer member of a connection defined by Scp.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As QueryRetrieveScu
Dim Scp As DicomScp
Dim DestAE As String
Dim StudyInstanceUID As String
Dim SeriesInstanceUID As String
Dim SopInstanceUID As String
instance.Move(Scp, DestAE, StudyInstanceUID, SeriesInstanceUID, SopInstanceUID)
|
Parameters
- Scp
- The peer connection to send the C-MOVE-REQ to.
- DestAE
- The name of the Application Entity to which to move the data. If DestAE is null
or empty the dataset will be moved to the AETitle defined in DicomFindSCU
- StudyInstanceUID
- The study instance UID of the study to move.
- SeriesInstanceUID
- The series instance UID of the series to move.
- SopInstanceUID
- The sop instance UID of the instance to move.
Example
Moves the specified instances to the local computer.
Visual Basic | Copy Code |
---|
Public Sub MoveInstance()
DicomEngine.Startup()
DicomNet.Startup()
Dim retrieveInstance As QueryRetrieveScu = New QueryRetrieveScu()
Dim query As FindQuery = New FindQuery()
Dim scp As DicomScp = New DicomScp()
Dim ds As DicomDataSet = New DicomDataSet()
scp.AETitle = "MI_SERVER"
scp.Port = 104
scp.Timeout = 60
scp.PeerAddress = IPAddress.Parse("10.1.1.96")
AddHandler retrieveInstance.BeforeCMove, AddressOf retrieveInstance_BeforeCMove
AddHandler retrieveInstance.Moved, AddressOf retrieveInstance_Moved
AddHandler retrieveInstance.AfterCMove, AddressOf retrieveInstance_AfterCMove
retrieveInstance.Move(scp, String.Empty, "1.2.840.114257.3.6.5.41964868", "1.2.840.114257.3.6.5.5.4214471", "1.2.840.114257.3.6.5.5.18900282")
DicomNet.Shutdown()
DicomEngine.Shutdown()
End Sub
Private Sub retrieveInstance_BeforeCMove(ByVal sender As Object, ByVal e As BeforeCMoveEventArgs)
Console.WriteLine("Before CMove")
End Sub
Private Sub PrintReferencedRequestSequence(ByVal rrs As List(Of ReferencedRequestSequence))
If rrs.Count > 0 Then
Console.WriteLine("Referenced Request Sequence")
For Each rr As ReferencedRequestSequence In rrs
Console.WriteLine(Constants.vbTab & "Accession Number: ", rr.AccessionNumber)
Console.WriteLine(Constants.vbTab & "Study Instance UID: " & rr.StudyInstanceUID)
Console.WriteLine(Constants.vbTab & "Requested Procedure ID: " & rr.RequestedProcedureId)
If rr.RequestedProcedureCodeSequence.Count > 0 Then
Console.WriteLine(Constants.vbTab & "Requested Procedure Code Sequence")
For Each rpc As CodeSequence In rr.RequestedProcedureCodeSequence
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Code Meaning: " & rpc.CodeMeaning)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Context Identifier: " & rpc.ContextIdentifier)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Scheme Designator: " & rpc.SchemeDesignator)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Scheme Version: " & rpc.SchemeVersion)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Value: " & rpc.Value)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "----------------------------------")
Next rpc
End If
Console.WriteLine(Constants.vbTab & "----------------------------------")
Next rr
End If
End Sub
Private Sub PrintConceptCodeNameSequence(ByVal ccs As CodeSequence)
If Not ccs Is Nothing Then
Console.WriteLine("Content Code Name Sequence")
Console.WriteLine(Constants.vbTab & "Code Meaning: " & ccs.CodeMeaning)
Console.WriteLine(Constants.vbTab & "Context Identifier: " & ccs.ContextIdentifier)
Console.WriteLine(Constants.vbTab & "Scheme Designator: " & ccs.SchemeDesignator)
Console.WriteLine(Constants.vbTab & "Scheme Version: " & ccs.SchemeVersion)
Console.WriteLine(Constants.vbTab & "Value: " & ccs.Value)
End If
End Sub
Private Sub retrieveInstance_Moved(ByVal sender As Object, ByVal e As MovedEventArgs)
Select Case e.Instance.InstanceType
Case InstanceLevel.EvidenceDocument
Dim ed As EvidenceDocumentInstance = TryCast(e.Instance, EvidenceDocumentInstance)
Console.WriteLine("Content Date: " & ed.ContentDate.ToString())
Console.WriteLine("Content Time: " & ed.ContentTime.ToString())
If Not ed.ContentTemplateSequence Is Nothing Then
Console.WriteLine("Content Template Sequence")
Console.WriteLine(Constants.vbTab & "Template Identifier: " & ed.ContentTemplateSequence.TemplateIdentifer)
End If
PrintReferencedRequestSequence(ed.ReferencedRequestSeqence)
PrintConceptCodeNameSequence(ed.ConceptNameCodeSequence)
Case InstanceLevel.Image
Dim ii As ImageInstance = TryCast(e.Instance, ImageInstance)
Console.WriteLine("Bits Allocated: " & ii.BitsAllocated)
Console.WriteLine("Columns: " & ii.Columns)
Console.WriteLine("Frames: " & ii.Frames)
Console.WriteLine("Rows: " & ii.Rows)
If Not ii.Images Is Nothing Then
Console.WriteLine("Image Size: " & ii.Images.BytesPerLine * ii.Images.Height)
End If
Case InstanceLevel.KeyImageNote
Dim ki As KeyImageInstance = TryCast(e.Instance, KeyImageInstance)
Console.WriteLine("Content Date: " & ki.ContentDate.ToString())
Console.WriteLine("Content Time: " & ki.ContentTime.ToString())
Console.WriteLine("Observation Date/Time: " & ki.ObservationDateTime.ToString())
PrintReferencedRequestSequence(ki.ReferencedRequestSequence)
PrintConceptCodeNameSequence(ki.ConceptNameCodeSequence)
Case InstanceLevel.PresentationState
Dim pi As PresentationStateInstance = TryCast(e.Instance, PresentationStateInstance)
Console.WriteLine("Presentation Label: " & pi.Label)
Console.WriteLine("Creation Date: " & pi.CreateDate.ToString())
Console.WriteLine("Creation Time: " & pi.CreateTime.ToString())
Console.WriteLine("Creators Name: " & pi.CreatorsName)
Console.WriteLine("Description: " & pi.Description)
If pi.ReferencedSeriesSequence.Count > 0 Then
Console.WriteLine("Referenced Series Sequence")
For Each rss As ReferencedSeriesSequence In pi.ReferencedSeriesSequence
Console.WriteLine(Constants.vbTab & "Series Instance UID: " & rss.SeriesInstanceUID)
If rss.ReferencedImageSequence.Count > 0 Then
Console.WriteLine(Constants.vbTab & "Referenced Image Sequence")
For Each ris As ReferencedImageSequence In rss.ReferencedImageSequence
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Referenced SOP Class UID: " & ris.ReferencedSOPClassUID)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Referenced SOP Instance UID: " & ris.ReferencedSOPInstanceUID)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "----------------------------------")
Next ris
End If
Console.WriteLine(Constants.vbTab & "----------------------------------")
Next rss
End If
Case InstanceLevel.StructuredReport
Dim si As SRInstance = TryCast(e.Instance, SRInstance)
Console.WriteLine("Completion Flag: " & si.CompletionFlag)
Console.WriteLine("Verification Flag: " & si.VerificationFlag)
Console.WriteLine("Content Date: " & si.ContentDate.ToString())
Console.WriteLine("Content Time: " & si.ContentTime.ToString())
Console.WriteLine("Observation Date/Time: " & si.ObservationDateTime.ToString())
If si.VerifyingObserverSequence.Count > 0 Then
Console.WriteLine("Verifying Observer Sequence")
For Each vos As VerifyingObserverSequence In si.VerifyingObserverSequence
Console.WriteLine(Constants.vbTab & "Verifying Organization: " & vos.VerifyingOrganization)
Console.WriteLine(Constants.vbTab & "Verification Date/Time: " & vos.VerificationDateTime.ToString())
Console.WriteLine(Constants.vbTab & "Verifying Observer Name: " & vos.VerifyingObserverName)
If vos.VerifyingObserverIdentificationCodeSequence.Count > 0 Then
Console.WriteLine("Verifying Observer Identification Code Sequence")
For Each cs As CodeSequence In vos.VerifyingObserverIdentificationCodeSequence
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Code Meaning: " & cs.CodeMeaning)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Context Identifier: " & cs.ContextIdentifier)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Scheme Designator: " & cs.SchemeDesignator)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Scheme Version: " & cs.SchemeVersion)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Value: " & cs.Value)
Console.WriteLine(Constants.vbTab + Constants.vbTab & "----------------------------------")
Next cs
End If
Console.WriteLine(Constants.vbTab & "----------------------------------")
Next vos
End If
PrintReferencedRequestSequence(si.ReferencedRequestSequence)
PrintConceptCodeNameSequence(si.ConceptNameCodeSequence)
End Select
End Sub
Private Sub retrieveInstance_AfterCMove(ByVal sender As Object, ByVal e As AfterCMoveEventArgs)
Console.WriteLine("{0} Completed", e.Completed)
Console.WriteLine("{0} Failed", e.Failed)
Console.WriteLine("{0} Warning", e.Warning)
Console.WriteLine("Status: {0}", e.Status)
End Sub |
C# | Copy Code |
---|
public void MoveInstance() { DicomEngine.Startup(); DicomNet.Startup(); QueryRetrieveScu retrieveInstance = new QueryRetrieveScu(); FindQuery query = new FindQuery(); DicomScp scp = new DicomScp(); DicomDataSet ds = new DicomDataSet(); // // Change these parameters to reflect your Dicom server. // scp.AETitle = "MI_SERVER"; scp.Port = 105; scp.Timeout = 60; scp.PeerAddress = IPAddress.Parse("10.1.1.96"); retrieveInstance.EnableMoveToSelf = true; retrieveInstance.BeforeCMove += new BeforeCMoveDelegate(retrieveInstance_BeforeCMove); retrieveInstance.Moved += new MovedDelegate(retrieveInstance_Moved); retrieveInstance.AfterCMove += new AfterCMoveDelegate(retrieveInstance_AfterCMove); retrieveInstance.Move(scp, string.Empty, "1.2.840.114257.3.6.5.41964868", "1.2.840.114257.3.6.5.5.4214471", "1.2.840.114257.3.6.5.5.18900282"); DicomNet.Shutdown(); DicomEngine.Shutdown(); } void retrieveInstance_BeforeCMove(object sender, BeforeCMoveEventArgs e) { Console.WriteLine("Before CMove"); } void PrintReferencedRequestSequence(List<ReferencedRequestSequence> rrs) { if (rrs.Count > 0) { Console.WriteLine("Referenced Request Sequence"); foreach (ReferencedRequestSequence rr in rrs) { Console.WriteLine("\tAccession Number: ", rr.AccessionNumber); Console.WriteLine("\tStudy Instance UID: " + rr.StudyInstanceUID); Console.WriteLine("\tRequested Procedure ID: " + rr.RequestedProcedureId); if (rr.RequestedProcedureCodeSequence.Count > 0) { Console.WriteLine("\tRequested Procedure Code Sequence"); foreach (CodeSequence rpc in rr.RequestedProcedureCodeSequence) { Console.WriteLine("\t\tCode Meaning: " + rpc.CodeMeaning); Console.WriteLine("\t\tContext Identifier: " + rpc.ContextIdentifier); Console.WriteLine("\t\tScheme Designator: " + rpc.SchemeDesignator); Console.WriteLine("\t\tScheme Version: " + rpc.SchemeVersion); Console.WriteLine("\t\tValue: " + rpc.Value); Console.WriteLine("\t\t----------------------------------"); } } Console.WriteLine("\t----------------------------------"); } } } void PrintConceptCodeNameSequence(CodeSequence ccs) { if (ccs != null) { Console.WriteLine("Content Code Name Sequence"); Console.WriteLine("\tCode Meaning: " + ccs.CodeMeaning); Console.WriteLine("\tContext Identifier: " + ccs.ContextIdentifier); Console.WriteLine("\tScheme Designator: " + ccs.SchemeDesignator); Console.WriteLine("\tScheme Version: " + ccs.SchemeVersion); Console.WriteLine("\tValue: " + ccs.Value); } } void retrieveInstance_Moved(object sender, MovedEventArgs e) { switch (e.Instance.InstanceType) { case InstanceLevel.EvidenceDocument: EvidenceDocumentInstance ed = e.Instance as EvidenceDocumentInstance; Console.WriteLine("Content Date: " + ed.ContentDate); Console.WriteLine("Content Time: " + ed.ContentTime); if (ed.ContentTemplateSequence != null) { Console.WriteLine("Content Template Sequence"); Console.WriteLine("\tTemplate Identifier: " + ed.ContentTemplateSequence.TemplateIdentifer); } PrintReferencedRequestSequence(ed.ReferencedRequestSeqence); PrintConceptCodeNameSequence(ed.ConceptNameCodeSequence); break; case InstanceLevel.Image: ImageInstance ii = e.Instance as ImageInstance; Console.WriteLine("Bits Allocated: " + ii.BitsAllocated); Console.WriteLine("Columns: " + ii.Columns); Console.WriteLine("Frames: " + ii.Frames); Console.WriteLine("Rows: " + ii.Rows); if (ii.Images != null) Console.WriteLine("Image Size: " + ii.Images.BytesPerLine * ii.Images.Height); break; case InstanceLevel.KeyImageNote: KeyImageInstance ki = e.Instance as KeyImageInstance; Console.WriteLine("Content Date: " + ki.ContentDate); Console.WriteLine("Content Time: " + ki.ContentTime); Console.WriteLine("Observation Date/Time: " + ki.ObservationDateTime); PrintReferencedRequestSequence(ki.ReferencedRequestSequence); PrintConceptCodeNameSequence(ki.ConceptNameCodeSequence); break; case InstanceLevel.PresentationState: PresentationStateInstance pi = e.Instance as PresentationStateInstance; Console.WriteLine("Presentation Label: " + pi.Label); Console.WriteLine("Creation Date: " + pi.CreateDate); Console.WriteLine("Creation Time: " + pi.CreateTime); Console.WriteLine("Creators Name: " + pi.CreatorsName); Console.WriteLine("Description: " + pi.Description); if (pi.ReferencedSeriesSequence.Count > 0) { Console.WriteLine("Referenced Series Sequence"); foreach (ReferencedSeriesSequence rss in pi.ReferencedSeriesSequence) { Console.WriteLine("\tSeries Instance UID: " + rss.SeriesInstanceUID); if (rss.ReferencedImageSequence.Count > 0) { Console.WriteLine("\tReferenced Image Sequence"); foreach (ReferencedImageSequence ris in rss.ReferencedImageSequence) { Console.WriteLine("\t\tReferenced SOP Class UID: " + ris.ReferencedSOPClassUID); Console.WriteLine("\t\tReferenced SOP Instance UID: " + ris.ReferencedSOPInstanceUID); Console.WriteLine("\t\t----------------------------------"); } } Console.WriteLine("\t----------------------------------"); } } break; case InstanceLevel.StructuredReport: SRInstance si = e.Instance as SRInstance; Console.WriteLine("Completion Flag: " + si.CompletionFlag); Console.WriteLine("Verification Flag: " + si.VerificationFlag); Console.WriteLine("Content Date: " + si.ContentDate); Console.WriteLine("Content Time: " + si.ContentTime); Console.WriteLine("Observation Date/Time: " + si.ObservationDateTime); if (si.VerifyingObserverSequence.Count > 0) { Console.WriteLine("Verifying Observer Sequence"); foreach (VerifyingObserverSequence vos in si.VerifyingObserverSequence) { Console.WriteLine("\tVerifying Organization: " + vos.VerifyingOrganization); Console.WriteLine("\tVerification Date/Time: " + vos.VerificationDateTime); Console.WriteLine("\tVerifying Observer Name: " + vos.VerifyingObserverName); if (vos.VerifyingObserverIdentificationCodeSequence.Count > 0) { Console.WriteLine("Verifying Observer Identification Code Sequence"); foreach (CodeSequence cs in vos.VerifyingObserverIdentificationCodeSequence) { Console.WriteLine("\t\tCode Meaning: " + cs.CodeMeaning); Console.WriteLine("\t\tContext Identifier: " + cs.ContextIdentifier); Console.WriteLine("\t\tScheme Designator: " + cs.SchemeDesignator); Console.WriteLine("\t\tScheme Version: " + cs.SchemeVersion); Console.WriteLine("\t\tValue: " + cs.Value); Console.WriteLine("\t\t----------------------------------"); } } Console.WriteLine("\t----------------------------------"); } } PrintReferencedRequestSequence(si.ReferencedRequestSequence); PrintConceptCodeNameSequence(si.ConceptNameCodeSequence); break; } } void retrieveInstance_AfterCMove(object sender, AfterCMoveEventArgs e) { Console.WriteLine("{0} Completed", e.Completed); Console.WriteLine("{0} Failed", e.Failed); Console.WriteLine("{0} Warning", e.Warning); Console.WriteLine("Status: {0}", e.Status); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also