public void EditorTest() { Process pacs = new Process(); pacs.StartInfo.FileName = Tools.RootFolder + @"\EK\Capture\Dicom\Tools\DicomEditor\bin\Debug\DicomEditor.exe"; ApplicationEntity editor = new ApplicationEntity("DICOMEDITOR", IPAddress.Parse("127.0.0.1"), 2009); ApplicationEntity console = new ApplicationEntity("CONSOLE", IPAddress.Parse("127.0.0.1"), 2010); try { pacs.Start(); StorageTest.Start(console); } catch { pacs.StartInfo.FileName = Tools.RootFolder + @"\EK\Capture\Dicom\Tools\DicomEditor\bin\Debug\DicomEditor.exe"; pacs.Start(); } Thread.Sleep(1000); StorageTest.store(@"EK\Capture\Dicom\DicomToolKit\Test\Data\DicomDir\THGLUZ5J.dcm", editor, true); System.Windows.Forms.MessageBox.Show("Click OK to stop Server."); StorageTest.Stop(); pacs.Kill(); }
public void InternalCMoveTest() { // make sure DICOM at "." is empty DicomDir dir = new DicomDir("."); dir.Empty(); ApplicationEntity storage = new ApplicationEntity("ImageServer", IPAddress.Parse("127.0.0.1"), 2000); ApplicationEntity server = new ApplicationEntity("ImageServer", IPAddress.Parse("127.0.0.1"), 5104); Dictionary <string, ApplicationEntity> stations = new Dictionary <string, ApplicationEntity>(); stations.Add(storage.Title, storage); StorageTest.Start(storage); CMoveTest.Start(server, stations); // add three images to a DICOMDIR at "." 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); // ask for an image from a DICOMDIR at "." be delivered to a DICOMDIR at "." // should create a duplicate SOPInstanceUID, which results in a WARNING try { move(storage.Title, server); } catch (Exception) { } CMoveTest.Stop(); StorageTest.Stop(); }
public void ServerTest() { ApplicationEntity host = new ApplicationEntity("ROCD4CZ14307CW", 5040); StorageTest.Start(host); System.Windows.Forms.MessageBox.Show("Click OK to stop Server."); StorageTest.Stop(); }
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 void StorageCommitTest() { ApplicationEntity editor = new ApplicationEntity("DICOMEDITOR", IPAddress.Parse("127.0.0.1"), 2009); ApplicationEntity console = new ApplicationEntity("CONSOLE", IPAddress.Parse("127.0.0.1"), 5040); StorageTest.Start(console); Thread.Sleep(1000); StorageTest.store(@"EK\Capture\Dicom\DicomToolKit\Test\Data\DicomDir\THGLUZ5J.dcm", editor, true); System.Windows.Forms.MessageBox.Show("Click OK to stop Server."); StorageTest.Stop(); }
public void EditorTest() { Process pacs = new Process(); pacs.StartInfo.FileName = Tools.RootFolder + @"\EK\Capture\Dicom\Tools\DicomEditor\bin\Debug\DicomEditor.exe"; ApplicationEntity editor = new ApplicationEntity("DICOMEDITOR", IPAddress.Parse("127.0.0.1"), 2009); ApplicationEntity console = new ApplicationEntity("CONSOLE", IPAddress.Parse("127.0.0.1"), 2010); try { pacs.Start(); StorageTest.Start(console); } catch { pacs.StartInfo.FileName = Tools.RootFolder + @"\EK\Capture\Dicom\Tools\DicomEditor\bin\Debug\DicomEditor.exe"; pacs.Start(); } Thread.Sleep(1000); StorageTest.store(@"EK\Capture\Dicom\DicomToolKit\Test\Data\DicomDir\THGLUZ5J.dcm", editor, false); RecordCollection records; Dictionary <string, string> filter; filter = new Dictionary <string, string>(); filter.Add(t.PatientID, "759275"); records = CFindTest.Query(editor, "STUDY", filter); if (records != null) { filter = new Dictionary <string, string>(); filter.Add(t.StudyInstanceUID, (string)records[0][t.StudyInstanceUID].Value); records = CFindTest.Query(editor, "SERIES", filter); if (records != null) { filter = new Dictionary <string, string>(); filter.Add(t.SeriesInstanceUID, (string)records[0][t.SeriesInstanceUID].Value); records = CFindTest.Query(editor, "IMAGE", filter); if (records != null) { CMoveServiceSCU move = new CMoveServiceSCU(SOPClass.StudyRootQueryRetrieveInformationModelMOVE); move.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); move.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); Association association = new Association(); association.AddService(move); if (association.Open(editor)) { if (move.Active) { move.ImageMoved += new CMoveEventHandler(OnImageMoved); try { //Element element = new Element(t.SOPInstanceUID, records[0][t.ReferencedSOPInstanceUIDinFile].Value); Element element = new Element(t.SOPInstanceUID, records[0][t.SOPInstanceUID].Value); DataSet results = move.CMove(console.Title, element); } catch (Exception ex) { Debug.WriteLine(ex.Message); throw; } finally { move.ImageMoved -= new CMoveEventHandler(OnImageMoved); } } } else { Debug.WriteLine("\ncan't Open."); } association.Close(); } } } pacs.Kill(); }