public void IdenticalPatientIDsAreEqual() { PatientID p1 = new PatientID("abc", "123", "foo"); PatientID p2 = new PatientID("abc", "123", "foo"); Assert.True(p1.Equals(p2)); Assert.Equal(p1, p2); }
/// <summary> </summary> /// <param name="context"></param> protected override void DoWork(CodeActivityContext context) { string localStatus = "FAILED"; ActivityStatus.Set(context, localStatus); string sSpatialRegistrationObjectType = ""; int nPatientID = 0; string sManfacturer = ""; string sModel = ""; string sSoftwareVersion = ""; string sModality = ""; string _dcmInstanceId = UnitId.Get(context); int nDcmInstanceId = Convert.ToInt32(_dcmInstanceId); context.GetExtension <CompositionContainer>().SatisfyImportsOnce(this); try { _processSpatialRegistrationObject.RetrieveSpatialRegistrationDetails(nDcmInstanceId, ref nPatientID, ref sManfacturer, ref sModel, ref sSoftwareVersion, ref sModality, ref sSpatialRegistrationObjectType); if (nPatientID > 0) { localStatus = "SUCCESS"; } SpatialRegistrationObjectType.Set(context, sSpatialRegistrationObjectType); PatientID.Set(context, nPatientID); Manufacturer.Set(context, sManfacturer); Model.Set(context, sModel); SoftwareVersion.Set(context, sSoftwareVersion); Modality.Set(context, sModality); ActivityStatus.Set(context, localStatus); } catch (Exception e) { ActivityStatus.Set(context, localStatus); } }
public string PrintValues() { NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat; nfi.PercentDecimalDigits = 0; string result = ""; result += "Patient ID: " + PatientID.ToString() + "\n"; result += "Age: " + Age + "\n"; result += "Gender: " + Gender + "\n"; result += "Education: " + Education + "\n"; result += "Country: " + Country + "\n"; result += "Ethnicity: " + Ethnicity + "\n"; result += "Nscore: " + (((Nscore + 3.46436) / 6.73829) * 48 + 12).ToString() + "\n"; result += "Escore: " + (((Escore + 3.88303) / 7.30924) * 48 + 12).ToString() + "\n"; result += "Oscore: " + (((Oscore + 5.33244) / 8.23405) * 48 + 12).ToString() + "\n"; result += "Ascore: " + (((Ascore + 3.46436) / 6.92872) * 48 + 12).ToString() + "\n"; result += "Cscore: " + (((Cscore + 4.28921) / 7.91854) * 48 + 12).ToString() + "\n"; result += "Impulsive: " + (((Impulsive + 2.55524) / 5.45685) * 90 + 30).ToString() + "\n"; result += "SS: " + ((Ss + 2.07848) / 4.00021).ToString("P", nfi) + "\n"; result += "User: "******"Y\n" : "N\n"; result += "Date: " + Date.ToString("dd/MM/yyyy") + "\n"; return(result); }
private void CheckIfPatientExist(DicomInfo dicom) { DAOGeneral dao = new DAOGeneral(); if ((dicom.studyUID.Length != 0 && dicom.seriesUID.Length != 0) && dicom.imageUID.Length != 0) { dao.patientExist(dicom); if (dicom.patientExist == true) { dao.seriesExist(dicom); } if (dicom.sameSeries == true) { dao.retrieveImageNumber(dicom); } } else { dao.patientExistBackup(dicom); if (dicom.sameSeries == true) { dao.retrieveImageNumber(dicom); } } if (dicom.patientExist == false) { PatientID id = new PatientID(); dicom.pID = id.generate(); } else if (dicom.sameSeries == false) { dao.updatePatientSeries(dicom); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "") { IQCareMsgBox.Show("SessionExpired", this); Response.Redirect("~/frmlogin.aspx", true); } ILabFunctions LabManager; int PatientID; PatientID = Convert.ToInt32(Session["PatientId"]); try { if (!IsPostBack) { LabManager = (ILabFunctions)ObjectFactory.CreateInstance("BusinessProcess.Laboratory.BLabFunctions, BusinessProcess.Laboratory"); DataSet theDS = (DataSet)LabManager.GetPatientLabOrder(PatientID.ToString()); ViewState["grddata"] = theDS; ViewState["gridSortDirection"] = "Desc"; this.grdLabOrderList.DataSource = theDS.Tables[0].DefaultView; this.grdLabOrderList.DataBind(); BindLaboratoryGrid(); } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); return; } }
protected void Page_Load(object sender, EventArgs e) { ILabFunctions LabManager; int PatientID; PatientID = Convert.ToInt32(Request.QueryString["PatientId"]); try { if (!IsPostBack) { LabManager = (ILabFunctions)ObjectFactory.CreateInstance("BusinessProcess.Laboratory.BLabFunctions, BusinessProcess.Laboratory"); DataSet theDS = (DataSet)LabManager.GetPatientLabOrder(PatientID.ToString()); ViewState["grddata"] = theDS; ViewState["gridSortDirection"] = "Desc"; this.grdLabOrderList.DataSource = theDS.Tables[0].DefaultView; this.grdLabOrderList.DataBind(); BindLaboratoryGrid(); } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); return; } }
public void DocumentPatientIDHasCorrectValue() { XElement idElts = TestDocXElement.ExternalIdentifiers(XDMetadataStandard.UUIDs.DocumentEntryPatientIdentityScheme).First(); PatientID id = PatientID.FromEscapedCx(idElts.Attribute("value").Value); Assert.True(Examples.TestDocument.PatientID.Equals(id)); }
public void SourcePatientIDHasCorrectValue() { PatientID expected = new PatientID("XYZ", "PDQ", "foo"); PatientID actual = PatientID.FromEscapedCx(TestDocXElement.SlotValue(XDMetadataStandard.Slots.SourcePatientID)); Assert.True(expected.Equals(actual)); }
//Metodo para interactuar public Boolean FillformDate(string sDate, string patientID, string doctorID, string observations) { AppointmentDate.SendKeys(sDate); PatientID.SendKeys(patientID); DoctorId.SendKeys(doctorID); Observaciones.SendKeys(observations); GuardarBTN.Click(); return(true); }
/// <summary> </summary> /// <param name="context"></param> protected override void DoWork(CodeActivityContext context) { string localStatus = "FAILED"; string _dcmInstanceId = UnitId.Get(context); int nDcmInstanceId = Convert.ToInt32(_dcmInstanceId); IList <string> sourceFrameOfReferenceUid = SourceFrameOfReferenceUID.Get(context); string targetFrameOfReferenceUid = TargetFrameOfReferenceUID.Get(context); IList <IList <double> > transformationMatrix = TransformationMatrix.Get(context); IList <int> planningImageIdValues = PlanningImageIdValues.Get(context); IList <int> verificationImageIdValues = VerificationImageIdValues.Get(context); IList <string> planningImageSopInstanceUidValues = PlanningImageSopInstanceValues.Get(context); IList <string> verificationImageSopInstanceUidValues = VerificationImageSopInstanceValues.Get(context); IList <string> planningFrameOfReferenceUidValues = PlanningImageFrameOfReferenceUidValues.Get(context); string spatialRegistrationObjectType = SpatialRegistrationObjectType.Get(context); string siteID = SiteID.Get(context); IList <decimal> dOffsetValues = new List <decimal>(6); int nOffsetId = 0; int nSiteID = 0; int nPatientID = 0; if (siteID.Length > 0) { nSiteID = Convert.ToInt32(siteID); } context.GetExtension <CompositionContainer>().SatisfyImportsOnce(this); bool result = _processSpatialRegistrationObject.PrepAndCreateOffsetRecords( nDcmInstanceId, spatialRegistrationObjectType, planningImageIdValues, verificationImageIdValues, planningImageSopInstanceUidValues, verificationImageSopInstanceUidValues, planningFrameOfReferenceUidValues, sourceFrameOfReferenceUid, targetFrameOfReferenceUid, transformationMatrix, nSiteID, ref nPatientID, ref nOffsetId, ref dOffsetValues); if (result) { localStatus = "SUCCESS"; } PatientID.Set(context, nPatientID.ToString()); OffsetID.Set(context, nOffsetId.ToString()); SroProcessedResult.Set(context, result); OffsetValues.Set(context, dOffsetValues); ActivityStatus.Set(context, localStatus); }
public override int GetHashCode() { unchecked { int hash = GetType().GetHashCode(); hash = (hash * 31) ^ PatientID.GetHashCode(); hash = (hash * 31) ^ DoctorID.GetHashCode(); return(hash); } }
public override int GetHashCode() { int hashCode = -1986329711; hashCode = hashCode * -1521134295 + Id.GetHashCode(); hashCode = hashCode * -1521134295 + PatientID.GetHashCode(); hashCode = hashCode * -1521134295 + DoctorID.GetHashCode(); hashCode = hashCode * -1521134295 + DiseaseID.GetHashCode(); hashCode = hashCode * -1521134295 + TreatmentID.GetHashCode(); hashCode = hashCode * -1521134295 + Date.GetHashCode(); return(hashCode); }
public void Print() { Console.WriteLine("InstanceData.SOPInstanceUID: " + SOPInstanceUID.ToStringNull()); Console.WriteLine("InstanceData.SeriesInstanceUID: " + SeriesInstanceUID.ToStringNull()); Console.WriteLine("InstanceData.StudyInstanceUID: " + StudyInstanceUID.ToStringNull()); Console.WriteLine("InstanceData.InstanceNumber: " + InstanceNumber.ToStringNull()); Console.WriteLine("InstanceData.TransferSyntax: " + TransferSyntax.ToStringNull()); Console.WriteLine("InstanceData.SOPClassUID: " + SOPClassUID.ToStringNull()); Console.WriteLine("InstanceData.StationName: " + StationName.ToStringNull()); Console.WriteLine("InstanceData.PatientID: " + PatientID.ToStringNull()); Console.WriteLine("InstanceData.NumberOfFrames: " + NumberOfFrames); }
/// <summary> </summary> /// <param name="context"></param> protected override void DoWork(CodeActivityContext context) { int nPatientID = PatientID.Get(context); string _dcmInstanceId = UnitId.Get(context); int nDcmInstanceId = Convert.ToInt32(_dcmInstanceId); int nFrameOfReferenceId = FrameOfReferenceId.Get(context); context.GetExtension <CompositionContainer>().SatisfyImportsOnce(this); // Update the registration record //_processSpatialRegistrationObject.UpdateRegistrationRecord(Guid, nDcmInstanceId, nPatientID, nFrameOfReferenceId); }
private void lsvPatient_DoubleClick(object sender, System.EventArgs e) { int CurrIndex = lsvPatient.SelectedItems[0].Index; this.SelectedIndex = CurrIndex; //PatientID=((DataRow)lsvPatient.Items[CurrIndex].Tag)["inpatientID_CHR"].ToString().Trim(); //PatientName=((DataRow)lsvPatient.Items[CurrIndex].Tag)["lastname_vCHR"].ToString().Trim(); PatientID = ((clsBIHPatientInfo)lsvPatient.Items[CurrIndex].Tag).m_strInHospitalNo; PatientName = ((clsBIHPatientInfo)lsvPatient.Items[CurrIndex].Tag).m_strPatientName; txtPatient.Text = PatientName.Trim(); txtPatient.Tag = PatientID.Trim(); m_cmdOK.Focus(); m_cmdOK.Select(); ((frmBIHOrderInput)(this.ParentForm)).m_mthSetCurrentPatient(PatientID.Trim()); ((frmBIHOrderInput)(this.ParentForm)).lblLeft_Click(); }
private void lsvPatient_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (lsvPatient.SelectedItems.Count > 0) { int CurrIndex = lsvPatient.SelectedItems[0].Index; this.SelectedIndex = CurrIndex; PatientID = ((DataRow)lsvPatient.Items[CurrIndex].Tag)["inpatientID_CHR"].ToString().Trim(); PatientName = ((DataRow)lsvPatient.Items[CurrIndex].Tag)["lastname_vCHR"].ToString().Trim(); txtPatient.Text = PatientName.Trim(); txtPatient.Tag = PatientID.Trim(); m_cmdOK.Focus(); m_cmdOK.Select(); ((frmBIHOrderInput)(this.ParentForm)).m_mthSetCurrentPatient(PatientID.Trim()); ((frmBIHOrderInput)(this.ParentForm)).lblLeft_Click(); } } }
/// <summary> </summary> /// <param name="context"></param> protected override void DoWork(CodeActivityContext context) { string localStatus = "FAILED"; bool status = SroProcessedResult.Get(context); string patientId = PatientID.Get(context); string siteId = SiteID.Get(context); IList <string> referencedImageSopInstanceValues = PlanningImageSopInstanceValues.Get(context); IList <string> verificationImageSopInstanceValues = VerificationImageSopInstanceValues.Get(context); IList <decimal> offsetValues = OffsetValues.Get(context); context.GetExtension <CompositionContainer>().SatisfyImportsOnce(this); bool result = _processSpatialRegistrationObject.SendSroProcessedMessage(status, Convert.ToInt32(patientId), Convert.ToInt32(siteId), referencedImageSopInstanceValues, verificationImageSopInstanceValues, offsetValues); if (result) { localStatus = "SUCCESS"; } ActivityStatus.Set(context, localStatus); }
private void m_cmdOK_Click(object sender, System.EventArgs e) { if (lsvPatient.SelectedItems.Count > 0) { int CurrIndex = lsvPatient.SelectedItems[0].Index; this.SelectedIndex = CurrIndex; //PatientID = ((DataRow)lsvPatient.Items[CurrIndex].Tag)["inpatientID_CHR"].ToString().Trim(); //PatientName = ((DataRow)lsvPatient.Items[CurrIndex].Tag)["lastname_vCHR"].ToString().Trim(); PatientID = ((clsBIHPatientInfo)lsvPatient.Items[CurrIndex].Tag).m_strInHospitalNo; PatientName = ((clsBIHPatientInfo)lsvPatient.Items[CurrIndex].Tag).m_strPatientName; txtPatient.Text = PatientName.Trim(); txtPatient.Tag = PatientID.Trim(); if (DialogResult == 0 && PatientID != null && PatientID != "") { ((frmBIHOrderInput)(this.ParentForm)).m_mthSetCurrentPatient(PatientID.Trim()); ((frmBIHOrderInput)(this.ParentForm)).lblLeft_Click(); } } else { MessageBox.Show("请选择病人"); } }
public void Initialize(PEMRContainer parentContainer, GetBriefQueue_Result queueResult) { if (queueResult == null || queueResult.PatientID == null) { return; } ParentPEMRContainer = parentContainer; ActiveQueueResult = queueResult; InvoiceDetailID = queueResult.InvoiceDetailID; PatientID = Convert.ToInt32(queueResult.PatientID); PatientName = queueResult.PatientFullName; DoctorID = Convert.ToInt32(queueResult.DoctorID); DoctorName = queueResult.DoctorFullName; ServiceName = queueResult.ServiceName; ReservationDateTime = Convert.ToDateTime(queueResult.ReservationTime) .ConvertDateTimeToString(true, true, true); lblPatientID.Text = PatientID.ToString(); lblPatientName.Text = PatientName; lblServiceName.Text = ServiceName; lblReservationTime.Text = ReservationDateTime; if (queueResult.ServiceID == null) { return; } Service_cu service = Service_cu.ItemsList.Find(item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(queueResult.ServiceID))); if (service == null) { return; } ServiceCategory_cu serviceCategory = ServiceCategory_cu.ItemsList.Find(item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(service.ServiceCategory_CU_ID))); if (serviceCategory == null) { return; } //TODO :: just add DisplayingColor to ServiceCategoryTable and it will work //if(serviceCategory.DisplayingColor == null) // if(service.DisplayingColor == null) // return; // else // { // object backColor = ApplicationStaticConfiguration.GetSkinColor(service.DisplayingColor); // if (backColor != null) // this.BackColor = Color.FromArgb(((Color) backColor).R, ((Color) backColor).G, // ((Color) backColor).B); // } //else //{ // object backColor = ApplicationStaticConfiguration.GetSkinColor(serviceCategory.DisplayingColor); // if (backColor != null) // this.BackColor = Color.FromArgb(((Color)backColor).R, ((Color)backColor).G, // ((Color)backColor).B); //} }
public void ConsumerConsumesSourcePatientId(XElement documentXEl, PatientID expected) { DocumentMetadata doc = XDMetadataConsumer.ConsumeDocument(documentXEl); Assert.Equal(expected, doc.SourcePtId); }
public void ConsumerConsumesPackagePatientId(XElement xl, PatientID expected) { DocumentPackage package = XDMetadataConsumer.Consume(xl); Assert.Equal(package.PatientId, expected); }
private void TraverseDirectoryTree(string root) { StreamWriter MetadataTable = null; StreamWriter CountsTable = null; int errorCount = 0, copyCount = 0, deleteCount = 0, extractCount = 0, tableCount = 0; lostTagCount = 0; Stack <string> dirs = new Stack <string>(100); List <string> files = new List <string>(); //Acquisition if (!Directory.Exists(root)) { throw new ArgumentException("Specified root directory doesn't exist: " + root); } dirs.Push(root); while (dirs.Count > 0) { string currentDir = dirs.Pop(); string[] subDirs; try { subDirs = Directory.GetDirectories(currentDir); } catch (UnauthorizedAccessException) { continue; } catch (DirectoryNotFoundException) { continue; } foreach (string str in subDirs) { dirs.Push(str); } // Push subdirectories on stack for traversal. string[] DICOMFiles = null; try { DICOMFiles = Directory.GetFiles(currentDir, "*.dcm"); } catch (UnauthorizedAccessException) { continue; } catch (DirectoryNotFoundException) { continue; } foreach (string file in DICOMFiles) { files.Add(file); } } // while dirs.Count > 0 //Processing; could technically be split off into a separate fuuuuunctionnnnnn //but i don't give a shit bool DoSimpleParse = !(checkBoxCreateMetadataTable.Checked || checkBoxExtractMetadata.Checked); List <StudyObject> StudyFiles = new List <StudyObject>(); int maxFiles = files.Count; for (int i = 0; i < maxFiles; i++) { float progress = ((float)(i + 1) / maxFiles); labelProgressBar.Text = string.Format("Processing file {0} of {1} ({2:p0})", i + 1, maxFiles, progress); progressBarDICOMFiles.Value = (int)Math.Floor(progress * 100); Application.DoEvents(); //keeps GUI alive by returning control to OS thread string DICOMFile = files[i]; string NewFolderName, NewFileName, StudyTime, PatientName, StudyDate, PatientID; int nFrames; DICOM.File dcf = null; try { //Take and open file, extract metadata dcf = new DICOM.File(DICOMFile, DoSimpleParse); PatientName = TagValueOrDefault(0x00100010, dcf.Tags); PatientID = TagValueOrDefault(0x00100020, dcf.Tags); StudyDate = TagValueOrDefault(0x00080023, dcf.Tags); StudyTime = TagValueOrDefault(0x00080033, dcf.Tags); if (!DoSimpleParse) { nFrames = int.Parse(TagValueOrDefault(0x00280008, dcf.Tags, "1")); } else { nFrames = ((new FileInfo(DICOMFile).Length / 1024) > 811) ? 125 : 1; } //single-image files are always 811KB big, so 811 * 1024 bytes; 125 frames is max and an assumption... switch (comboBoxCopyMode.SelectedIndex) { case 0: //Both break; case 1: //Images only if (nFrames > 1) { continue; } break; case 2: //Videos only if (nFrames < 2) { continue; } break; } NewFolderName = string.Format("{0}_{1}_{2}", StudyDate, PatientID, PatientName); foreach (char c in InvalidPathChars) { NewFolderName = NewFolderName.Replace(c.ToString(), ""); } //sanitize path input foreach (char c in new char[] { '/', '\\', '?' }) { NewFolderName = NewFolderName.Replace(c.ToString(), "-"); } //these aren't in InvalidPathChars since they're allowed in (full) paths if (comboBoxExportMode.SelectedIndex == 1) { NewFolderName = PatientID.ToLowerInvariant() + Path.DirectorySeparatorChar + NewFolderName; } if (comboBoxExportMode.SelectedIndex == 2) { NewFolderName = ""; } //no subfolders } // try catch (FileNotFoundException) { errorCount++; continue; } if (checkBoxExportPerStudyCounts.Checked || checkBoxCreateMetadataTable.Checked) { StudyObject obj = new StudyObject(); string[] FolderSplit = DICOMFile.Split(Path.DirectorySeparatorChar); obj.Folder = string.Join(Path.DirectorySeparatorChar.ToString(), FolderSplit.Take(FolderSplit.Length - 1)); obj.File = FolderSplit.Skip(FolderSplit.Length - 1).ToArray()[0]; obj.PatientID = PatientID; obj.PatientName = PatientName; obj.StudyDate = StudyDate; obj.StudyTime = StudyTime; obj.nFrames = (short)nFrames; obj.NewFolder = NewFolderName; StudyFiles.Add(obj); } DirectoryInfo OutputFolder = new DirectoryInfo(Path.Combine(textBoxOutputDirectory.Text, NewFolderName)); if (checkBoxCopyAndRename.Checked || checkBoxExtractMetadata.Checked) { //prepare receiving folder if (!Directory.Exists(OutputFolder.FullName)) { try { Directory.CreateDirectory(OutputFolder.FullName); } catch (UnauthorizedAccessException) { MessageBox.Show("Cannot gain access to " + textBoxOutputDirectory.Text + ". Please select another directory or run as administrator."); return; } } //if FolderName doesn't exist } if (checkBoxCopyAndRename.Checked) { //Ensure numbering is consistent and continuous int nPictures = 1, nVideos = 1; //HACK to ensure Image/Video numbers are study-specific even if no subfolders are being used - previous code searched *.dcm responding to ALL files from ALL studies string searchStr = string.Format("{0}_*_{1}_*.dcm", StudyDate, PatientID, PatientName); foreach (char c in new char[] { '/', '\\', '?' }) { searchStr = searchStr.Replace(c.ToString(), "-"); } //these are invalid as f**k for files foreach (char c in InvalidFileChars) { searchStr.Replace(c.ToString(), ""); } FileInfo[] ExistingFiles = OutputFolder.GetFiles(searchStr); nPictures += ExistingFiles.Where(n => n.Name.Contains("Image")).Count(); nVideos += ExistingFiles.Where(n => n.Name.Contains("Video")).Count(); NewFileName = string.Format("{0}_{1}_{2}_{3}_{4}.dcm", StudyDate, StudyTime, PatientID, PatientName, (nFrames > 1 ? ("Video" + nVideos) : ("Image" + nPictures))); foreach (char c in new char[] { '/', '\\', '?' }) { NewFileName = NewFileName.Replace(c.ToString(), "-"); } //these are invalid as f**k for files foreach (char c in InvalidFileChars) { NewFileName.Replace(c.ToString(), ""); } //Copy File, Test File, if there's a request, Delete File string NewFilePath = Path.Combine(OutputFolder.FullName, NewFileName); if (File.Exists(NewFilePath)) { //Need to change name not to overwrite; safety first int fileCount = OutputFolder.GetFiles(Path.GetFileNameWithoutExtension(NewFileName) + "*").Length + 1; NewFileName = string.Format("{0}({1}){2}", Path.GetFileNameWithoutExtension(NewFileName), fileCount, Path.GetExtension(NewFileName)); NewFilePath = Path.Combine(OutputFolder.FullName, NewFileName); } //File.Exists(NewFilePath) try { File.Copy(DICOMFile, NewFilePath); copyCount++; } catch (UnauthorizedAccessException) { MessageBox.Show("Access denied for export directory. Please select another directory or restart as administrator."); return; } catch (IOException ioe) { MessageBox.Show("Unexpected IO Exception: " + ioe.Message); } if (checkBoxCheckAndDeleteAfterCopy.Checked) { if (TestFileEquality(new FileInfo(DICOMFile), new FileInfo(NewFilePath))) { File.Delete(DICOMFile); deleteCount++; } } //checkBoxCheckAndDeleteAfterCopy.Checked } //if checkboxCopyAndRename.Checked if (checkBoxExtractMetadata.Checked) { using (StreamWriter metadataFile = new StreamWriter(Path.Combine(OutputFolder.FullName, "metadata.txt"), true)) { metadataFile.WriteLine("Metadata extracted from " + DICOMFile + "\nTag\tValue"); foreach (DICOM.Tag tag in dcf.Tags) { metadataFile.WriteLine(tag.Name + "\t" + tag.Value); } //TODO something fucky here. metadataFile.WriteLine("\n"); extractCount++; } } //if checkboxExtractMetadata.Checked } //foreach DICOMFile if (checkBoxCreateMetadataTable.Checked) { MetadataTable = new StreamWriter(Path.Combine(textBoxOutputDirectory.Text, DateTime.Now.ToString("yyyy-MM-dd_HH-mm") + "_DICOMFilesMetadata-Table.txt"), false); MetadataTable.WriteLine("Filename\tPatient ID\tPatient Name\tStudy Date\tStudy Time\tData Type\tFrames"); foreach (var obj in StudyFiles) { MetadataTable.WriteLine(string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}", Path.Combine(obj.Folder, obj.File), obj.PatientID, obj.PatientName, obj.StudyDate, obj.StudyTime, (obj.nFrames > 1 ? "Movie" : "Image"), obj.nFrames)); tableCount++; } MetadataTable.Flush(); MetadataTable.Close(); } if (checkBoxExportPerStudyCounts.Checked) { HashSet <string> DataFolders = new HashSet <string>(StudyFiles.Select(x => x.Folder)); CountsTable = new StreamWriter(Path.Combine(textBoxOutputDirectory.Text, DateTime.Now.ToString("yyyy-MM-dd_HH-mm") + "_DICOMFiles-DataPerStudyTable.txt"), false); CountsTable.WriteLine("Full Path\tStudy\tImages\tVideos"); foreach (var DataFolder in DataFolders) { HashSet <string> Studies = new HashSet <string>(StudyFiles.Where(x => x.Folder == DataFolder).Select(x => x.NewFolder)); foreach (var Study in Studies) { IEnumerable <StudyObject> Members = StudyFiles.Where(x => (x.NewFolder == Study && x.Folder == DataFolder)); CountsTable.WriteLine(string.Format("{0}\t{1}\t{2}\t{3}", DataFolder, Study, Members.Count(y => y.nFrames <= 1), Members.Count(y => y.nFrames > 1))); } } CountsTable.Flush(); CountsTable.Close(); } //Generating success message to user string Report = "Operation(s) completed successfully\n"; string LostTagReport = lostTagCount > 0 ? lostTagCount + " values could not found and defaulted to 'undefined'.\n" : ""; if (checkBoxCopyAndRename.Checked) { Report += copyCount + " files copied and renamed. " + LostTagReport; } if (checkBoxCheckAndDeleteAfterCopy.Checked) { Report += deleteCount + " files deleted.\n"; } if (checkBoxExtractMetadata.Checked) { Report += "Metadata extracted for " + extractCount + " files. " + LostTagReport; } if (checkBoxCreateMetadataTable.Checked) { Report += tableCount + " files processed for metadata table. " + LostTagReport; } progressBarDICOMFiles.Value = 100; Application.DoEvents(); MessageBox.Show(Report, "DICOM processing complete."); } // TraverseDirectoryTree
/// <summary> /// Gets this patient's data from the database and inserts it into this patient's properties /// </summary> private void FillPatientProperties() { //access DB for Patient table, accessing the row which matches the patient ID DataSet patientDetails = DatabaseConnection.Instance.GetDataSet($"SELECT * FROM Patient WHERE PatientID = {PatientID.ToString()}"); if (patientDetails.Tables[0].Rows.Count == 1) //ensures that there is data in the dataset { //enter each row in the property data FirstName = patientDetails.Tables[0].Rows[0][1].ToString(); //FirstName LastName = patientDetails.Tables[0].Rows[0][2].ToString(); //LastName DOB = patientDetails.Tables[0].Rows[0][3].ToString(); //DateOfBirth Condition = patientDetails.Tables[0].Rows[0][5].ToString(); //Condition Image = patientDetails.Tables[0].Rows[0][4].ToString(); //Image } }
/** * \brief <b>Brief Description</b> - Program <b><i>class method</i></b> - Gets the string array representation * \details <b>Details</b> * * Gets the string array representation of the Appointment object for saving to the database. * * \return <b>string[]</b> - the string array */ public string[] ToStringArray() { return(new string[] { AppointmentID.ToString(), PatientID.ToString(), DependantID.ToString(), RecallFlag.ToString() }); }
public override string ToString() { return(VisitDate.Date.ToString() + " " + DoctorID.ToString() + " " + PatientID.ToString()); }
public void Unlock(PatientID patient) { patientID = patient; GetComponentInChildren <Text>().text = patientID.name; unlocked = true; }
/// <summary> /// /// </summary> /// <param name="packageXEl"></param> /// <returns></returns> public static DocumentPackage ConsumePackage(XElement packageXEl) { DocumentPackage package = new DocumentPackage(); package.Author = ConsumeAuthor(packageXEl.Classification(XDMetadataStandard.UUIDs.SubmissionSetAuthor)); package.Comments = packageXEl.DescriptionValue(); package.ContentTypeCode = ConsumeCodedValue(packageXEl.Classification(XDMetadataStandard.UUIDs.ContentTypeCode)); package.IntendedRecipients.AddAll(packageXEl.SlotValues <Recipient>(XDMetadataStandard.Slots.IntendedRecipient, r => Recipient.FromXONXCNXTN(r))); package.PatientId = packageXEl.ExternalIdentifierValue <PatientID>(XDMetadataStandard.UUIDs.SubmissionSetPatientId, s => PatientID.FromEscapedCx(s)); package.SourceId = packageXEl.ExternalIdentifierValue(XDMetadataStandard.UUIDs.SubmissionSetSourceId); package.SubmissionTime = packageXEl.SlotValue <DateTime?>(XDMetadataStandard.Slots.SubmissionTime, s => HL7Util.DateTimeFromHL7Value(s)); package.Title = packageXEl.NameValue(); package.UniqueId = packageXEl.ExternalIdentifierValue(XDMetadataStandard.UUIDs.SubmissionSetUniqueId); return(package); }
public override int GetHashCode() { return(PatientID.GetHashCode()); }
/// <summary> /// Creates a document from an XML XElement representation /// </summary> public static DocumentMetadata ConsumeDocument(XElement docXEl) { DocumentMetadata doc = new DocumentMetadata(); doc.Author = ConsumeAuthor(docXEl.Classification(XDMetadataStandard.UUIDs.DocumentAuthor)); doc.Class = ConsumeCodedValue(docXEl.Classification(XDMetadataStandard.UUIDs.DocumentClass)); doc.Comments = docXEl.DescriptionValue(); doc.Confidentiality = ConsumeCodedValue(docXEl.Classification(XDMetadataStandard.UUIDs.DocumentConfidentiality)); doc.CreatedOn = docXEl.SlotValue <DateTime?>(XDMetadataStandard.Slots.CreationTime, s => HL7Util.DateTimeFromHL7Value(s)); doc.EventCodes = docXEl.Classifications(XDMetadataStandard.UUIDs.EventCode).Select(c => ConsumeCodedValue(c)); doc.FormatCode = ConsumeCodedValue(docXEl.Classification(XDMetadataStandard.UUIDs.FormatCode)); doc.FacilityCode = ConsumeCodedValue(docXEl.Classification(XDMetadataStandard.UUIDs.FacilityCode)); doc.Hash = docXEl.SlotValue(XDMetadataStandard.Slots.Hash); doc.LanguageCode = docXEl.SlotValue(XDMetadataStandard.Slots.LanguageCode); doc.LegalAuthenticator = docXEl.SlotValue <Person>(XDMetadataStandard.Slots.LegalAuthenticator, s => Person.FromXCN(s)); doc.MediaType = docXEl.AttributeValue(XDMetadataStandard.Attrs.MimeType); doc.PatientID = docXEl.ExternalIdentifierValue(XDMetadataStandard.UUIDs.DocumentEntryPatientIdentityScheme, s => PatientID.FromEscapedCx(s)); doc.ServiceStart = docXEl.SlotValue <DateTime?>(XDMetadataStandard.Slots.ServiceStart, s => HL7Util.DateTimeFromHL7Value(s)); doc.ServiceStop = docXEl.SlotValue <DateTime?>(XDMetadataStandard.Slots.ServiceStop, s => HL7Util.DateTimeFromHL7Value(s)); doc.PracticeSetting = ConsumeCodedValue(docXEl.Classification(XDMetadataStandard.UUIDs.PracticeSetting)); doc.Size = docXEl.SlotValue <int?>(XDMetadataStandard.Slots.Size, s => Parse(s)); doc.SourcePtId = docXEl.SlotValue <PatientID>(XDMetadataStandard.Slots.SourcePatientID, s => PatientID.FromEscapedCx(s)); doc.Patient = Person.FromSourcePatientInfoValues(docXEl.SlotValues(XDMetadataStandard.Slots.SourcePatientInfo)); doc.Title = docXEl.NameValue(); // Ignore TypeCode doc.UniqueId = docXEl.ExternalIdentifierValue(XDMetadataStandard.UUIDs.DocumentUniqueIdIdentityScheme); doc.Uri = ConsumeUriValues(docXEl.SlotValues(XDMetadataStandard.Slots.Uri)); return(doc); }