static void store(string title, IPAddress address, int port) { StorageServiceSCU dx = new StorageServiceSCU(StorageClass.DigitalXRayImageStorageForPresentation); dx.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); StorageServiceSCU cr = new StorageServiceSCU(StorageClass.ComputedRadiographyImageStorage); cr.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); Association association = new Association(); association.AddService(dx); association.AddService(cr); if (association.Open(title, address, port)) { if (dx.Active) { DataSet dicom = GetDataSet(@"..\..\test.dcm"); dx.Store(dicom); System.Console.WriteLine("store done!"); } } else { System.Console.WriteLine("\ncan't Open."); } //System.Console.WriteLine("before Close!"); association.Close(); //System.Console.WriteLine("after Close!"); }
public static void store(string path, ApplicationEntity host, bool request_commit) { StorageServiceSCU cr = new StorageServiceSCU(SOPClass.ComputedRadiographyImageStorage); cr.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); cr.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); StorageServiceSCU dx = new StorageServiceSCU(SOPClass.DigitalXRayImageStorageForPresentation); dx.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); dx.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); StorageServiceSCU dx2 = new StorageServiceSCU(SOPClass.DigitalXRayImageStorageForProcessing); dx2.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); dx2.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); StorageServiceSCU sc = new StorageServiceSCU(SOPClass.SecondaryCaptureImageStorage); sc.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); sc.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); StorageCommitServiceSCU commit = new StorageCommitServiceSCU(); commit.Syntaxes.Add(Syntax.ExplicitVrLittleEndian); commit.Syntaxes.Add(Syntax.ImplicitVrLittleEndian); Association association = new Association(); association.AddService(cr); association.AddService(dx); association.AddService(dx2); association.AddService(sc); association.AddService(commit); if (association.Open(host)) { if (cr.Active) { DataSet dicom = DataSetTest.GetDataSet(Path.Combine(Tools.RootFolder, path)); // insure that the SOPClassUID matches what negotiated and are using dicom.Set(t.SOPClassUID, cr.SOPClassUId); string instance = (string)dicom[t.SOPInstanceUID].Value; try { cr.Store(dicom); Debug.WriteLine("store done!"); if (request_commit && commit.Active) { commit.Request(dicom); Debug.WriteLine("storage commit requested!"); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } } } else { Debug.WriteLine("\ncan't Open."); } association.Close(); }