private void getPatientData(String filePath) { DicomFile dcm = DicomFile.Open(filePath); DicomDataset dcmDataset = dcm.Dataset; CTDicomInfo ctEntity = new CTDicomInfo(); ctEntity.PatientName = dcmDataset.Get <String>(DicomTag.PatientName, ""); ctEntity.PatientAge = dcmDataset.Get <String>(DicomTag.PatientAge, ""); ctEntity.PatientSex = dcmDataset.Get <String>(DicomTag.PatientSex, ""); ctEntity.InstitutionName = dcmDataset.Get <String>(DicomTag.InstitutionName, ""); ctEntity.AcquisitionDate = dcmDataset.Get <String>(DicomTag.AcquisitionDate, ""); ctEntity.AcquisitionTime = dcmDataset.Get <String>(DicomTag.AcquisitionTime, ""); ctEntity.SliceThickness = dcmDataset.Get <double>(DicomTag.SliceThickness); _selectedPatient = ctEntity; }
private void btnTemp_Click(object sender, EventArgs e) { RibbonStyle.RibbonMenuButton btnTemp = (RibbonStyle.RibbonMenuButton)sender; int number = int.Parse(btnTemp.Name); if (number < _CTPathList.Count) { _selectPath = _CTPathList[number].ToString(); _selectedtCTDicomInfo = (CTDicomInfo)_CTPatientsList[number]; ctview.SetImageList(_dictionary[_selectPath]); } else { System.Windows.MessageBox.Show("数据不存在"); } }
/// <summary> /// 将路径下的一套CT数据的病人信息读取出来 /// </summary> /// <param name="dicomPath"></param> private void setCTData(String dicomPath) { //ArrayList CTFileList = _dictionary[dicomPath]; DicomFile dcm = DicomFile.Open(dicomPath); DicomDataset dcmDataset = dcm.Dataset; CTDicomInfo ctEntity = new CTDicomInfo(); ctEntity.PatientName = dcmDataset.Get <String>(DicomTag.PatientName, ""); ctEntity.PatientAge = dcmDataset.Get <String>(DicomTag.PatientAge, ""); ctEntity.PatientSex = dcmDataset.Get <String>(DicomTag.PatientSex, ""); ctEntity.InstitutionName = dcmDataset.Get <String>(DicomTag.InstitutionName, ""); ctEntity.AcquisitionDate = dcmDataset.Get <String>(DicomTag.AcquisitionDate, ""); ctEntity.AcquisitionTime = dcmDataset.Get <String>(DicomTag.AcquisitionTime, ""); _CTPatientsList.Add(ctEntity); }
private string zipFolder2Zip(string folder, CTDicomInfo dicomInfo) { string fileName = string.Format("[{0}][{3}][{1}][{2}].zip", dicomInfo.PatientName, dicomInfo.InstitutionName, System.Net.Dns.GetHostName(), DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss")); //string args = string.Format("a -tzip \"{0}\" \"{1}\" \"{2}\" \"{3}\"", fileName, SelectedPatient.GetFile(""), SelectedPatient.DicomFolder, fileName); string args = string.Format("a -tzip \"{0}\" \"{1}\" \"{2}\" \"{3}\"", fileName, fileName, fileName, fileName); var psi = new ProcessStartInfo(Application.StartupPath + @"\HaoZipC.exe", args); Process.Start(psi).WaitForExit(); MessageBox.Show(string.Format(@"压缩完毕。 文件保存到{0}。", fileName)); //Process.Start(new FileInfo(fileName).Directory.FullName); return(fileName); }
/// <summary> /// 判断一个不包含文件夹的文件夹是不是符合CT文件夹,文件夹中的CT文件数要大于20 /// </summary> /// <param name="folderPath">需要判断的文件夹路径</param> public void checkCTFolder(String folderPath) { //DirectoryInfo dir = new DirectoryInfo(folderPath); //FileInfo[] fileList = dir.GetFiles(); string[] files = Directory.GetFiles(folderPath); if (files.Length < 1) { return; } Array.Sort(files, new FileNameComparer1()); ArrayList CTFileList = new ArrayList(); bool firstDicom = false; int tempIndex = 0; foreach (string file in files) { //判断文件路径是不是DICOM if (isDicom(file)) { firstDicom = true; Console.WriteLine(file); CTFileList.Add(file); ctview.SetPicturexBoxImage(file); if (tempIndex == 0) { _dictionary.Add(folderPath, CTFileList); _CTPathList.Add(folderPath); String path = folderPath; RibbonStyle.RibbonMenuButton btnTemp = addThumbImageRibbonBtn(path, _index); panelCTList.Controls.Add(btnTemp); setCTData(file); this.dataGridCT.ItemsSource = null; this.dataGridCT.ItemsSource = _CTPatientsList; System.Windows.Forms.Application.DoEvents(); ++_index; firstDicom = false; _selectedtCTDicomInfo = (CTDicomInfo)_CTPatientsList[tempIndex]; if (btnTemp != null) { btnTemp.PerformClick(); } ctview.SetData(_selectedtCTDicomInfo, files.Length); } tempIndex++; } } //if(CTFileList.Count>=20) //{ //IComparer fileNameCompare = new FilesNameComparerClass(); //CTFileList.Sort(fileNameCompare); //Array temp = CTFileList.ToArray(); //Array.Sort(temp, new FileNameComparer1()); //CTFileList.Clear(); //foreach(String s in temp){ // CTFileList.Add(s); //} //_dictionary.Add(folderPath,CTFileList); //_CTPathList.Add(folderPath); //} //if (_CTPathList.Count != 0) //{ //ctview.SetImage(_dictionary[_CTPathList[0].ToString()]); //} }