public void SendDicomFile(string filepath) { using (var scu = new StorageScu(LocalNode.AeTitle, RemoteNode.AeTitle, RemoteNode.IpAddress, RemoteNode.Port)) { scu.ImageStoreCompleted += ScuOnImageStorageCompleted; scu.AddFile(filepath); scu.Send(); } }
// Called when a SOP Instance is imported into the local datastore private void OnSopInstanceImported(object sender, ItemEventArgs <ImportedSopInstanceInformation> e) { if (_sopInstanceUidToAeTitle.ContainsKey(e.Item.SopInstanceUid)) { var destinationAeTitle = _sopInstanceUidToAeTitle[e.Item.SopInstanceUid]; var destinationServer = FindAETitle(new ServerTree().RootNode.ServerGroupNode, destinationAeTitle); if (destinationServer == null) { Platform.Log(LogLevel.Error, "Study " + e.Item.SopInstanceUid + " cannot be send to server. Failed to find server infromation for AE Title " + destinationAeTitle + "."); } else { var storageScu = new StorageScu(ServerTree.GetClientAETitle(), destinationServer.AETitle, destinationServer.Host, destinationServer.Port); storageScu.ImageStoreCompleted += OnStoreEachInstanceCompleted; storageScu.AddFile(e.Item.SopInstanceFileName); storageScu.BeginSend(OnAnnotationSendComplete, storageScu); } lock (_mapLock) _sopInstanceUidToAeTitle.Remove(e.Item.SopInstanceUid); } }
private void button1_Click(object sender, EventArgs e) { _storageScu = new StorageScu(editAE.Text, editAE.Text, editIP.Text, Convert.ToInt16(editPort.Text)); _storageScu.ImageStoreCompleted += new EventHandler <StorageInstance>(storageScu_StoreCompleted); //_storageScu.AddStorageInstance(new StorageInstance("AnotherFile.dcm")); ClearCanvas.ImageViewer.ImageViewerComponent viewer = null; DesktopWindow desktopWindow = null; List <string> _filenames = new List <string>(); foreach (DesktopWindow window in Application.DesktopWindows) { foreach (Workspace space in window.Workspaces) { if (space.Title == "imageview") { desktopWindow = window; viewer = space.Component as ClearCanvas.ImageViewer.ImageViewerComponent; } } } if (viewer != null) { //foreach (string strfile in viewer.getCurrentFiles()) // _storageScu.AddFile(strfile); //先解压缩,然后再发送 //foreach (string strfile in viewer.getCurrentFiles()) // _storageScu.AddFile(strfile); RasterSupport.Unlock(RasterSupportType.Dicom, "y47S3rZv6U"); RasterSupport.Unlock(RasterSupportType.Document, "HbQR9NSXQ3"); RasterSupport.Unlock(RasterSupportType.DocumentWriters, "BhaNezSEBB"); RasterSupport.Unlock(RasterSupportType.DocumentWritersPdf, "3b39Q3YMdX"); RasterSupport.Unlock(RasterSupportType.ExtGray, "bpTmxSfx8R"); RasterSupport.Unlock(RasterSupportType.Forms, "GpC33ZK78k"); RasterSupport.Unlock(RasterSupportType.IcrPlus, "9vdKEtBhFy"); RasterSupport.Unlock(RasterSupportType.IcrProfessional, "3p2UAxjTy5"); RasterSupport.Unlock(RasterSupportType.J2k, "Hvu2PRAr3z"); RasterSupport.Unlock(RasterSupportType.Jbig2, "43WiSV4YNB"); RasterSupport.Unlock(RasterSupportType.Jpip, "YbGG7wWiVJ"); RasterSupport.Unlock(RasterSupportType.Pro, ""); RasterSupport.Unlock(RasterSupportType.LeadOmr, "J3vh828GC8"); RasterSupport.Unlock(RasterSupportType.MediaWriter, "TpjDw2kJD2"); RasterSupport.Unlock(RasterSupportType.Medical, "ZhyFRnk3sY"); RasterSupport.Unlock(RasterSupportType.Medical3d, "DvuzH3ePeu"); RasterSupport.Unlock(RasterSupportType.MedicalNet, "b4nBinY7tv"); RasterSupport.Unlock(RasterSupportType.MedicalServer, "QbXwuZxA3h"); RasterSupport.Unlock(RasterSupportType.Mobile, ""); RasterSupport.Unlock(RasterSupportType.Nitf, "G37rmw5dTr"); DicomEngine.Startup(); foreach (string strfile in viewer.getCurrentFiles()) { DicomDataSet ds = new DicomDataSet(); try { ds.Load(strfile, DicomDataSetLoadFlags.None); ds.ChangeTransferSyntax(DicomUidType.ImplicitVRLittleEndian, 2, ChangeTransferSyntaxFlags.None); ds.Save(strfile + "1", DicomDataSetSaveFlags.None); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } _storageScu.AddFile(strfile + "1"); } } else { System.Windows.Forms.MessageBox.Show("没有合适的图像。。。"); } IAsyncResult asyncResult = _storageScu.BeginSend(new AsyncCallback(SendComplete), _storageScu); }