void mwl(string title, IPAddress address, int port, Dictionary <string, string> filter) { CFindServiceSCU mwl = new CFindServiceSCU(SOPClass.ModalityWorklistInformationModelFIND); mwl.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); mwl.Syntaxes.Add(Syntax.ExplicitVrBigEndian); mwl.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); Association association = new Association(); association.AddService(mwl); if (association.Open(title, address, port)) { DataSet query = GetQuery(filter); RecordCollection records = mwl.CFind(query); RecordCollectionTest.WriteRecords(records); } else { System.Console.WriteLine("\ncan't Open."); } association.Close(); }
static void Main(string[] args) { try { if (Setup(args)) { CFindServiceSCU mwl = new CFindServiceSCU(SOPClass.ModalityWorklistInformationModelFIND); mwl.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); mwl.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); mwl.Syntaxes.Add(Syntax.ExplicitVrBigEndian); Association association = new Association(); association.AddService(mwl); if (association.Open(scu, scp, address, port)) { DataSet query = GetQuery(); RecordCollection records = mwl.CFind(query); DumpRecords(records); } else { throw new Exception(String.Format("Can't connect to {0}:{1}:{2}", scp, address, port)); } association.Close(); } } catch (Exception ex) { System.Console.Out.WriteLine(ex.Message); } }
static void move(string destination, ApplicationEntity host) { CMoveServiceSCU pm = new CMoveServiceSCU(SOPClass.PatientRootQueryRetrieveInformationModelMOVE); pm.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); pm.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); CFindServiceSCU pf = new CFindServiceSCU(SOPClass.PatientRootQueryRetrieveInformationModelFIND); pf.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); pf.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); CMoveServiceSCU sm = new CMoveServiceSCU(SOPClass.StudyRootQueryRetrieveInformationModelMOVE); sm.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); sm.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); CFindServiceSCU sf = new CFindServiceSCU(SOPClass.StudyRootQueryRetrieveInformationModelFIND); sf.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); sf.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); Association association = new Association(); association.AddService(pm); association.AddService(pf); association.AddService(sm); association.AddService(sf); if (association.Open(host)) { if (sm.Active) { sm.ImageMoved += new CMoveEventHandler(OnImageMoved); try { Element element = new Element(t.StudyInstanceUID, "1.2.840.113564.109517115.2009111711190101521"); DataSet results = sm.CMove(destination, element); } catch (Exception ex) { Debug.WriteLine(ex.Message); throw; } finally { sm.ImageMoved -= new CMoveEventHandler(OnImageMoved); } } } else { Debug.WriteLine("\ncan't Open."); } association.Close(); }
public void InternalQueryTest2() { DicomDir dir = new DicomDir("."); dir.Empty(); ApplicationEntity storage = new ApplicationEntity("ImageServer", IPAddress.Parse("127.0.0.1"), 2000); StorageTest.Start(storage); StorageTest.store(@"EK\Capture\Dicom\DicomToolKit\Test\Data\DicomDir\Y2ASNFDS.dcm", storage, false); StorageTest.store(@"EK\Capture\Dicom\DicomToolKit\Test\Data\DicomDir\WNGVU1P1.dcm", storage, false); StorageTest.store(@"EK\Capture\Dicom\DicomToolKit\Test\Data\DicomDir\THGLUZ5J.dcm", storage, false); StorageTest.Stop(); ApplicationEntity host = new ApplicationEntity("IMAGESERVER", 2190); CFindTest.Start(host); CFindServiceSCU find = new CFindServiceSCU(SOPClass.StudyRootQueryRetrieveInformationModelFIND); find.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); Association association = new Association(); association.AddService(find); if (association.Open(host.Title, host.Address, host.Port)) { Series series = new Series(); series[t.StudyInstanceUID].Value = "1.2.840.113564.109517115.2009111711190101521"; DataSet filter = new DataSet(); filter.Elements = series.Elements; filter.Set(t.QueryRetrieveLevel, "SERIES"); RecordCollection records = find.CFind(filter); RecordCollectionTest.WriteRecords(records); } else { System.Console.WriteLine("\ncan't Open."); } association.Close(); dir.Empty(); CFindTest.Stop(); }
public static RecordCollection Query(ApplicationEntity host, string level, Dictionary <string, string> filter) { RecordCollection records = null; CFindServiceSCU study = new CFindServiceSCU(SOPClass.StudyRootQueryRetrieveInformationModelFIND); study.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); study.Syntaxes.Add(Syntax.ExplicitVrBigEndian); study.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); Association association = new Association(); association.AddService(study); if (association.Open(host)) { DataSet query = null; switch (level) { case "PATIENT": query = GetPatientQuery(filter); break; case "STUDY": query = GetStudyQuery(filter); break; case "SERIES": query = GetSeriesQuery(filter); break; case "IMAGE": query = GetImageQuery(filter); break; } records = study.CFind(query); } else { System.Console.WriteLine("\ncan't Open."); } association.Close(); return(records); }