public void Initialize_Scenario(Device device, Modality modality, int kinect = 0, int wimus = 0)
 {
     _device = device;
     _modality = modality;
     _number_of_kinect = kinect;
     _number_of_WIMUs = wimus;
 }
    protected void OnGUI()
    {
        string buttonText = ((int)(modality & Modality.Linguistic) == 1) ? "Language Off" : "Language On";

        float buttonWidth = GUI.skin.label.CalcSize (new GUIContent (buttonText)).x + 14;

        if (GUI.Button (new Rect (Screen.width - buttonWidth - 12, Screen.height - 60, buttonWidth, 22), buttonText)) {
            modality ^= Modality.Linguistic;
        }
    }
        public void Test_Name()
        {
            Procedure procedure = new Procedure();
            string description = "description.";
            Modality modality = new Modality();

            ModalityProcedureStep procedureStep = new ModalityProcedureStep(procedure, description, modality);

            Assert.AreEqual("Modality", procedureStep.Name);
        }
        public void Test_IsPreStep()
        {
            Procedure procedure = new Procedure();
            string description = "description.";
            Modality modality = new Modality();

            ModalityProcedureStep procedureStep = new ModalityProcedureStep(procedure, description, modality);

            Assert.IsFalse(procedureStep.IsPreStep);
        }
        public void Test_GetLinkedProcedures()
        {
            Procedure procedure = new Procedure();
            string description = "description.";
            Modality modality = new Modality();

            ModalityProcedureStep procedureStep = new ModalityProcedureStep(procedure, description, modality);

            Assert.IsNotNull(procedureStep.GetLinkedProcedures());
            Assert.IsEmpty(procedureStep.GetLinkedProcedures());
        }
        public void Test_Constructor()
        {
            Procedure procedure = new Procedure();
            string description = "description.";
            Modality modality = new Modality();

            ModalityProcedureStep procedureStep = new ModalityProcedureStep(procedure, description, modality);

            Assert.AreEqual(procedure, procedureStep.Procedure);
            Assert.AreEqual(description, procedureStep.Description);
            Assert.AreEqual(modality, procedureStep.Modality);
        }
Exemple #7
0
		public static string ToSopClassUid(Modality modality)
		{
			switch (modality)
			{
				case Modality.CT:
					return SopClass.CtImageStorageUid;
				case Modality.MR:
					return SopClass.MrImageStorageUid;
				case Modality.PT:
					return SopClass.PositronEmissionTomographyImageStorageUid;
				case Modality.SC:
				default:
					return SopClass.SecondaryCaptureImageStorageUid;
			}
		}
Exemple #8
0
        public bool NewModality(ModalityEventViewModel modalityEventView, out string message)
        {
            message = string.Empty;

            Modality modality = new Modality();

            Util.CopyNonNullProperty(modalityEventView, modality);
            modality.IsActive    = true;
            modality.IsVisible   = true;
            modality.IsMandatory = false;

            using (var unitOfWork = CreateUnitOfWork())
            {
                PHSEvent phsEvent = unitOfWork.Events.GetEvent(modalityEventView.EventID);
                int      count    = phsEvent.Modalities.Count;
                modality.Position = count;

                string roleToUpdate = string.Empty;

                foreach (var modalityRole in modalityEventView.ModalityRole)
                {
                    if (modalityRole.Checked)
                    {
                        roleToUpdate += Constants.Form_Option_Split_Concate + modalityRole.Name;
                    }
                }

                if (!string.IsNullOrEmpty(roleToUpdate))
                {
                    roleToUpdate = roleToUpdate.Remove(0, 1);
                }

                modality.Role = roleToUpdate;

                phsEvent.Modalities.Add(modality);

                using (TransactionScope scope = new TransactionScope())
                {
                    unitOfWork.Complete();
                    scope.Complete();
                }

                return(true);
            }
        }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("text");
     writer.WriteStringValue(Text);
     writer.WritePropertyName("participantId");
     writer.WriteStringValue(ParticipantId);
     writer.WritePropertyName("id");
     writer.WriteStringValue(Id);
     if (Optional.IsDefined(Language))
     {
         writer.WritePropertyName("language");
         writer.WriteStringValue(Language);
     }
     writer.WritePropertyName("modality");
     writer.WriteStringValue(Modality.ToString());
     writer.WriteEndObject();
 }
Exemple #10
0
            public async Task <Unit> Handle(Command request, CancellationToken cancellationToken)
            {
                var modality = new Modality
                {
                    Id          = request.Id,
                    Name        = request.Name,
                    DisplayName = request.DisplayName
                };

                _context.Modalities.Add(modality);
                var success = await _context.SaveChangesAsync() > 0;

                if (success)
                {
                    return(Unit.Value);
                }

                throw new Exception("Problem saving changes");
            }
Exemple #11
0
        public void Handle(SourceModalityCreateCommand command)
        {
            var entity = _entities.Get <Modality>()
                         .SingleOrDefault(p => p.ID.ToString() == command.Id);

            if (entity == null)
            {
                entity = new Modality()
                {
                    ID           = command.Id,
                    ModalityName = command.ModalityName
                };
                _entities.Create(entity);
                int rowsAffected = _entities.SaveChanges();
                if (rowsAffected > 0)
                {
                }
            }
        }
Exemple #12
0
        public static void modInjection(XElement xElement)
        {
            XNamespace df = xElement.Name.Namespace;

            Modality modality = Modality.getModality(xElement.Element(df + "modality").Value);

            string accessionNumber = xElement.Element(df + "accessionNumber").Value;

            string patientID       = xElement.Element(df + "patientID").Value;
            string patientSurname  = xElement.Element(df + "patientSurname").Value;
            string patientLastname = xElement.Element(df + "patientLastname").Value;

            string uniqueExamIdentifier = xElement.Element(df + "uniqueExamIdentifier").Value;
            string examCode             = xElement.Element(df + "examCode").Value;
            string dateOfBirth          = xElement.Element(df + "dateOfBirth").Value;
            bool   gender     = bool.Parse(xElement.Element(df + "gender").Value);
            bool   inpatient  = bool.Parse(xElement.Element(df + "inpatient").Value);
            string wardNumber = xElement.Element(df + "wardNumber").Value;

            ObservableCollection <RP> rPs = new ObservableCollection <RP>();

            if (xElement.Element(df + "rp1").Value != "")
            {
                rPs.Add(RP.getRP(xElement.Element(df + "rp1").Value));
            }
            if (xElement.Element(df + "rp2").Value != "")
            {
                rPs.Add(RP.getRP(xElement.Element(df + "rp2").Value));
            }

            Doctor doctor = Doctor.getDoctor(xElement.Element(df + "doctor").Value);

            float    uptakeTime    = float.Parse(xElement.Element(df + "uptakeTime").Value);
            DateTime injectionTime = Convert.ToDateTime(xElement.Element(df + "injectionTime").Value);

            Room room = Room.getRoom(xElement.Element(df + "selectedRoom").Value);

            bool   isContrast    = bool.Parse(xElement.Element(df + "isContrast").Value);
            bool   isDelay       = bool.Parse(xElement.Element(df + "isDelay").Value);
            string patientStatus = (xElement.Element(df + "patientStatus").Value);

            modInjection(accessionNumber, modality, patientID, patientSurname, patientLastname, uniqueExamIdentifier, examCode, dateOfBirth, gender, inpatient, wardNumber, rPs, doctor, uptakeTime, injectionTime, room, isContrast, isDelay, patientStatus);
        }
Exemple #13
0
        private void EchoModality()
        {
            Modality modality = GetSelectedModality();

            if (modality == null)
            {
                return;
            }

            string myAE = this.textBoxAETitle.Text;

            if (modality.Echo(myAE))
            {
                MessageBox.Show(this, "Echo succeeded.", "Echo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(this, "Echo failed.", "Echo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #14
0
        private void EditModality()
        {
            Modality modality = GetSelectedModality();

            if (modality == null)
            {
                return;
            }

            FormModality frm = new FormModality(modality);

            if (frm.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            RefreshModalityList();
            SelectModality(modality);
            RefreshModalityButton();
        }
Exemple #15
0
        private void SaveSetting()
        {
            Modality  scp = _mgt.GetSCPConfig();
            SCUConfig scu = _mgt.GetSCUConfig();

            if (scp == null || scu == null)
            {
                return;
            }

            scp.AETitle              = this.textBoxSCPAET.Text;
            scp.IPAddress            = this.textBoxSCPIP.Text.Trim();
            scp.Port                 = (int)this.numericUpDownSCPPort.Value;
            scu.AETitle              = this.textBoxSCUAET.Text;
            scu.MaxPduLength         = (int)this.numericUpDownPDULength.Value;
            scu.AssociationTimeOut   = (int)this.numericUpDownTimeOut.Value;
            _mgt.InvokeInterval      = (int)this.numericUpDownTimer.Value;
            _mgt.CharacterSetName    = this.comboBoxCharacterSet.Text;
            _mgt.SendCharacterSetTag = this.checkBoxSendCharacterSetTag.Checked;
        }
Exemple #16
0
        private void LoadSetting()
        {
            Modality  scp = _mgt.GetSCPConfig();
            SCUConfig scu = _mgt.GetSCUConfig();

            if (scp == null || scu == null)
            {
                return;
            }

            this.textBoxSCPAET.Text                  = scp.AETitle;
            this.textBoxSCPIP.Text                   = scp.IPAddress;
            this.numericUpDownSCPPort.Value          = scp.Port;
            this.textBoxSCUAET.Text                  = scu.AETitle;
            this.numericUpDownPDULength.Value        = scu.MaxPduLength;
            this.numericUpDownTimeOut.Value          = scu.AssociationTimeOut;
            this.numericUpDownTimer.Value            = _mgt.InvokeInterval;
            this.comboBoxCharacterSet.Text           = _mgt.CharacterSetName;
            this.checkBoxSendCharacterSetTag.Checked = _mgt.SendCharacterSetTag;
        }
        public void Test_Reassign()
        {
            Procedure procedure = new Procedure();
            string description = "description.";
            Modality modality = new Modality();
            ModalityProcedureStep procedureStep = new ModalityProcedureStep(procedure, description, modality);
            procedureStep.Suspend();

            Staff performer = new Staff();
            ProcedureStep newStep = procedureStep.Reassign(performer); // Perform event

            // just need to test that it returns a new instance of this class
            // everything else has been covered in base class tests
            Assert.IsNotNull(newStep);
            Assert.AreNotEqual(this, newStep);
            Assert.IsInstanceOfType(typeof(ModalityProcedureStep), newStep);
            Assert.AreEqual(procedure, newStep.Procedure);
            Assert.AreEqual(description, ((ModalityProcedureStep)newStep).Description);
            Assert.AreEqual(modality, ((ModalityProcedureStep)newStep).Modality);
        }
Exemple #18
0
        /// <summary>
        /// Validates this imaging examination result
        /// </summary>
        /// <param name="path">The path to this object as a string</param>
        /// <param name="messages">the validation messages to date, these may be added to within this method</param>
        void IDiagnosticImagingExaminationResult.Validate(string path, List <ValidationMessage> messages)
        {
            var vb = new ValidationBuilder(path, messages);

            var diagnosticImagingExaminationResult = (IDiagnosticImagingExaminationResult)this;

            vb.ArgumentRequiredCheck("OverallResultStatus", diagnosticImagingExaminationResult.OverallResultStatus);

            if (vb.ArgumentRequiredCheck("ExaminationResultName", ExaminationResultName))
            {
                ExaminationResultName.ValidateMandatory(vb.Path + "ExaminationResultName", messages);
            }

            if (vb.ArgumentRequiredCheck("Modality", Modality))
            {
                Modality.Validate(vb.Path + "Modality", messages);
            }

            if (diagnosticImagingExaminationResult.AnatomicalSite != null)
            {
                for (int index = 0; index < diagnosticImagingExaminationResult.AnatomicalSite.Count; index++)
                {
                    diagnosticImagingExaminationResult.AnatomicalSite[index].Validate(vb.Path + string.Format("AnatomicalSite[{0}]", index), messages);
                }
            }

            // Optional Related Image
            if (RelatedImage != null)
            {
                RelatedImage.Validate(vb.Path + "RelatedImage", messages); // Checks that the ImageUrl is included
            }

            vb.ArgumentRequiredCheck("ExaminationProcedure", ExaminationProcedure);

            if (vb.ArgumentRequiredCheck("ExaminationDetails", ExaminationDetails))
            {
                ExaminationDetails.Validate(vb.Path + "ExaminationDetails", messages);
            }

            vb.ArgumentRequiredCheck("ObservationDateTime", ObservationDateTime);
        }
Exemple #19
0
        private void DeleteModality()
        {
            SCPConfig cfg = _mgt.GetSCPConfig();

            if (cfg == null)
            {
                return;
            }

            Modality modality = GetSelectedModality();

            if (modality == null)
            {
                return;
            }

            cfg.KnownModalities.Remove(modality);

            RefreshModalityList();
            RefreshModalityButton();
        }
Exemple #20
0
        public void DeleteEventModalityTest_Success()
        {
            PHSEvent phsEvent = new PHSEvent()
            {
                Title    = "Test",
                Venue    = "Test",
                StartDT  = DateTime.Now.AddDays(-1),
                EndDT    = DateTime.Now.AddDays(1),
                IsActive = true
            };

            Modality modality = new Modality()
            {
                Name        = "Test Modality",
                IsMandatory = true,
                IsActive    = false
            };

            phsEvent.Modalities.Add(modality);

            _unitOfWork.Events.Add(phsEvent);

            _unitOfWork.Complete();

            string message = string.Empty;

            var record = _target.GetEventByID(1, out message);

            Assert.IsNotNull(record);
            Assert.AreEqual(1, record.Modalities.Count);

            var saveResult = _target.DeleteEventModality(1, record.PHSEventID, out message);

            Assert.IsTrue(saveResult);

            var result = _target.GetEventByID(record.PHSEventID, out message);

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Modalities.Count);
        }
Exemple #21
0
        public void RetrieveAllFormsTest()
        {
            int  formId  = 1;
            Guid entryId = new Guid();

            PHSEvent phsEvent = new PHSEvent()
            {
                Title    = "Test 15",
                Venue    = "Test",
                StartDT  = DateTime.Now.AddDays(-200),
                EndDT    = DateTime.Now.AddDays(-199),
                IsActive = false
            };

            Modality modality = new Modality()
            {
                Name = "Test Modality"
            };

            Form form = new Form
            {
                Title     = "Test form",
                DateAdded = new DateTime()
            };

            _unitOfWork.Events.Add(phsEvent);

            modality.Forms.Add(form);

            phsEvent.Modalities.Add(modality);

            _unitOfWork.Complete();

            string message = string.Empty;
            var    result  = _target.RetrieveAllForms(1, out message);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Forms.Count);
        }
Exemple #22
0
        public bool DeleteEventModality(int modalityid, int eventid, out string message)
        {
            message = string.Empty;
            try
            {
                using (var unitOfWork = CreateUnitOfWork())
                {
                    var phsEvent = unitOfWork.Events.GetEvent(eventid);

                    if (phsEvent == null)
                    {
                        message = "Invalid Event Id";
                        return(false);
                    }

                    Modality modalityToDelete = unitOfWork.Modalities.Get(modalityid);

                    if (modalityToDelete != null)
                    {
                        using (TransactionScope scope = new TransactionScope())
                        {
                            phsEvent.Modalities.Remove(modalityToDelete);
                            unitOfWork.Modalities.Remove(modalityToDelete);

                            unitOfWork.Complete();
                            scope.Complete();
                        }
                    }
                    message = string.Empty;
                    return(true);
                }
            }
            catch (Exception ex)
            {
                ExceptionLog(ex);
                message = "Operation failed during deleting Modality";
                return(false);
            }
        }
Exemple #23
0
        public void DeleteFormAndTemplate_UnableToDeleteWhenAttachedToModality()
        {
            Template          template;
            TemplateViewModel templateViewModel;

            CreateDefaultTemplateAndField(out template, out templateViewModel);

            PHSEvent phsEvent = new PHSEvent()
            {
                Title    = "Test",
                Venue    = "Test",
                StartDT  = DateTime.Now.AddDays(-1),
                EndDT    = DateTime.Now.AddDays(1),
                IsActive = true
            };

            Modality modality = new Modality()
            {
                Name        = "Test Modality",
                IsMandatory = true
            };

            Form form = _unitOfWork.FormRepository.Find(f => f.FormID == template.FormID).FirstOrDefault();

            Assert.IsNotNull(form);

            modality.Forms.Add(form);

            phsEvent.Modalities.Add(modality);

            _unitOfWork.Events.Add(phsEvent);

            _unitOfWork.Complete();

            string deleteResult = _target.DeleteFormAndTemplate(template.FormID);

            Assert.AreEqual("Unable to delete - Form is already attached to a modality", deleteResult);
        }
Exemple #24
0
        public void NewEventTest_Success()
        {
            PHSEvent phsEvent = new PHSEvent()
            {
                Title    = "Test",
                Venue    = "Test",
                StartDT  = DateTime.Now.AddDays(1),
                EndDT    = DateTime.Now.AddDays(10),
                IsActive = false
            };

            Modality modality = new Modality()
            {
                Name        = "Test Modality",
                IsMandatory = true,
                IsActive    = false
            };

            phsEvent.Modalities.Add(modality);

            string message = string.Empty;

            var saveResult = _target.NewEvent(phsEvent, out message);

            Assert.IsTrue(saveResult);
            Assert.AreEqual(string.Empty, message);

            var result = _target.GetEventByID(1, out message);

            Assert.IsNotNull(result);
            Assert.AreEqual("Test", result.Title);
            Assert.IsTrue(result.IsActive);

            Assert.IsNotNull(result.Modalities);
            Assert.AreEqual(1, result.Modalities.Count);
            Assert.IsTrue(result.Modalities.First().IsActive);
            Assert.AreEqual("Test Modality", result.Modalities.First().Name);
        }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("conversationItems");
     writer.WriteStartArray();
     foreach (var item in ConversationItems)
     {
         writer.WriteObjectValue(item);
     }
     writer.WriteEndArray();
     writer.WritePropertyName("id");
     writer.WriteStringValue(Id);
     writer.WritePropertyName("language");
     writer.WriteStringValue(Language);
     writer.WritePropertyName("modality");
     writer.WriteStringValue(Modality.ToString());
     if (Optional.IsDefined(Domain))
     {
         writer.WritePropertyName("domain");
         writer.WriteStringValue(Domain.Value.ToString());
     }
     writer.WriteEndObject();
 }
Exemple #26
0
		private static string GetSopClassUidByModality(Modality modality)
		{
			switch (modality)
			{
				case Modality.CT:
					return SopClass.CtImageStorageUid;
				case Modality.MR:
					return SopClass.MrImageStorageUid;
				case Modality.PT:
					return SopClass.PositronEmissionTomographyImageStorageUid;
			}
			return SopClass.SecondaryCaptureImageStorageUid;
		}
Exemple #27
0
		private static DicomAttributeCollection CreateMockDataset(string patientName, string studyInstanceUid, string frameOfReferenceUid, Modality modality, int columns, int rows, bool signed, SizeF pixelSpacing)
		{
			DicomAttributeCollection dataset = new DicomAttributeCollection();
			dataset[DicomTags.PatientId].SetStringValue("PATIENT");
			dataset[DicomTags.PatientsName].SetStringValue(patientName);
			dataset[DicomTags.StudyId].SetStringValue("STUDY");
			dataset[DicomTags.SeriesDescription].SetStringValue(string.Format("SERIES-{0}", modality));
			dataset[DicomTags.StudyInstanceUid].SetStringValue(studyInstanceUid);
			dataset[DicomTags.SeriesInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
			dataset[DicomTags.SopInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
			dataset[DicomTags.SopClassUid].SetStringValue(GetSopClassUidByModality(modality));
			dataset[DicomTags.Modality].SetStringValue(modality.ToString());
			dataset[DicomTags.FrameOfReferenceUid].SetStringValue(frameOfReferenceUid);
			dataset[DicomTags.PixelSpacing].SetStringValue(string.Format(@"{0}\{1}", pixelSpacing.Height, pixelSpacing.Width));
			dataset[DicomTags.PhotometricInterpretation].SetStringValue("MONOCHROME2");
			dataset[DicomTags.BitsStored].SetInt32(0, 16);
			dataset[DicomTags.BitsAllocated].SetInt32(0, 16);
			dataset[DicomTags.HighBit].SetInt32(0, 15);
			dataset[DicomTags.PixelRepresentation].SetInt32(0, signed ? 1 : 0);
			dataset[DicomTags.Rows].SetInt32(0, rows);
			dataset[DicomTags.Columns].SetInt32(0, columns);
			dataset[DicomTags.WindowCenter].SetInt32(0, signed ? 0 : 32768);
			dataset[DicomTags.WindowWidth].SetInt32(0, 65536);
			dataset[DicomTags.WindowCenterWidthExplanation].SetString(0, "Full Window");
			return dataset;
		}
Exemple #28
0
		public ISopDataSource[] CreateSops(bool signed, Modality modality, Vector3D voxelSpacing, Vector3D sliceAxisX, Vector3D sliceAxisY, Vector3D sliceAxisZ)
		{
			var seriesInstanceUid = DicomUid.GenerateUid().UID;
			var slicerParams = new VolumeSlicerParams(sliceAxisX, sliceAxisY, sliceAxisZ);
			var volume = CreateVolume(signed, modality, voxelSpacing);
			using (VolumeSlicer slicer = new VolumeSlicer(volume, slicerParams, seriesInstanceUid))
			{
				return new List<ISopDataSource>(slicer.CreateSlices()).ToArray();
			}
		}
        public void FindTemplateToDisplay_OlderVersionAfterSubmitBefore()
        {
            ParticipantJourneySearchViewModel psm = new ParticipantJourneySearchViewModel();

            psm.Nric       = "S8250369B";
            psm.PHSEventId = 1;

            int formId = 1;

            PHSEvent phsEvent = new PHSEvent()
            {
                Title    = "Test 15",
                Venue    = "Test",
                StartDT  = DateTime.Now.AddDays(-200),
                EndDT    = DateTime.Now.AddDays(-199),
                IsActive = false
            };

            Participant participant = new Participant()
            {
                Nric = "S8250369B"
            };

            Modality modality = new Modality()
            {
                Name = "Test Modality"
            };

            Form form = new Form
            {
                IsActive = true,
                Title    = "Test form"
            };

            Template templateOne = new Template()
            {
                Status    = Constants.TemplateStatus.DRAFT.ToString(),
                IsActive  = true,
                Version   = 1,
                DateAdded = DateTime.Now
            };

            Template templateTwo = new Template()
            {
                Status    = Constants.TemplateStatus.DRAFT.ToString(),
                IsActive  = true,
                Version   = 2,
                DateAdded = DateTime.Now
            };

            _unitOfWork.Events.Add(phsEvent);

            participant.PHSEvents.Add(phsEvent);

            _unitOfWork.Participants.Add(participant);

            form.Templates.Add(templateOne);
            form.Templates.Add(templateTwo);

            modality.Forms.Add(form);

            phsEvent.Modalities.Add(modality);

            _unitOfWork.Complete();

            ParticipantJourneyModality journeyModality = new ParticipantJourneyModality()
            {
                ParticipantID = 1,
                PHSEventID    = psm.PHSEventId,
                ModalityID    = 1,
                FormID        = formId,
                TemplateID    = 1
            };

            _unitOfWork.ParticipantJourneyModalities.Add(journeyModality);

            _unitOfWork.Complete();

            string message = string.Empty;

            var result = _target.FindTemplateToDisplay(psm, formId, 1, false, TemplateFieldMode.INPUT, out message);

            Assert.IsNotNull(result);

            var templateResult = _target.FindTemplate(result.TemplateID.Value);

            Assert.IsNotNull(templateResult);
            Assert.AreEqual(1, templateResult.Version);
        }
        public void RetrieveParticipantJourneyModality_ShouldHaveRecord()
        {
            ParticipantJourneySearchViewModel psm = new ParticipantJourneySearchViewModel();

            psm.Nric       = "S8250369B";
            psm.PHSEventId = 1;

            int  formId  = 1;
            Guid entryId = new Guid();

            PHSEvent phsEvent = new PHSEvent()
            {
                Title    = "Test 15",
                Venue    = "Test",
                StartDT  = DateTime.Now.AddDays(-200),
                EndDT    = DateTime.Now.AddDays(-199),
                IsActive = false
            };

            Participant participant = new Participant()
            {
                Nric        = "S8250369B",
                DateOfBirth = DateTime.Now,
                HomeNumber  = "88776655"
            };

            Modality modality = new Modality()
            {
                Name = "Test Modality"
            };

            Form form = new Form
            {
                Title = "Test form"
            };

            _unitOfWork.Events.Add(phsEvent);

            participant.PHSEvents.Add(phsEvent);

            _unitOfWork.Participants.Add(participant);

            modality.Forms.Add(form);

            phsEvent.Modalities.Add(modality);

            ParticipantJourneyModality journeyModality = new ParticipantJourneyModality()
            {
                ParticipantID = 1,
                PHSEventID    = psm.PHSEventId,
                ModalityID    = 1,
                FormID        = formId,
                EntryId       = entryId
            };

            _unitOfWork.ParticipantJourneyModalities.Add(journeyModality);

            _unitOfWork.Complete();

            string message = string.Empty;

            ParticipantJourneyModality result = _target.RetrieveParticipantJourneyModality(psm, formId, 1, out message);

            Assert.IsNotNull(result);
            Assert.AreEqual(entryId, result.EntryId);
        }
Exemple #31
0
        private static void AddProcedureSteps(Procedure procedure, int numMps)
        {
            Modality m = new Modality("01", "CT", procedure.PerformingFacility, null, null);

            for (int s = 0; s < numMps; s++)
            {
                ModalityProcedureStep step = new ModalityProcedureStep();
                step.Description = "MPS 10" + s;
                step.Modality = m;
                procedure.AddProcedureStep(step);
            }
        }
 public static string ToString(Modality value)
 {
     if( value==Modality.AR )
         return "AR";
     else if( value==Modality.AU )
         return "AU";
     else if( value==Modality.BDUS )
         return "BDUS";
     else if( value==Modality.BI )
         return "BI";
     else if( value==Modality.BMD )
         return "BMD";
     else if( value==Modality.CR )
         return "CR";
     else if( value==Modality.CT )
         return "CT";
     else if( value==Modality.DG )
         return "DG";
     else if( value==Modality.DX )
         return "DX";
     else if( value==Modality.ECG )
         return "ECG";
     else if( value==Modality.EPS )
         return "EPS";
     else if( value==Modality.ES )
         return "ES";
     else if( value==Modality.GM )
         return "GM";
     else if( value==Modality.HC )
         return "HC";
     else if( value==Modality.HD )
         return "HD";
     else if( value==Modality.IO )
         return "IO";
     else if( value==Modality.IVOCT )
         return "IVOCT";
     else if( value==Modality.IVUS )
         return "IVUS";
     else if( value==Modality.KER )
         return "KER";
     else if( value==Modality.KO )
         return "KO";
     else if( value==Modality.LEN )
         return "LEN";
     else if( value==Modality.LS )
         return "LS";
     else if( value==Modality.MG )
         return "MG";
     else if( value==Modality.MR )
         return "MR";
     else if( value==Modality.NM )
         return "NM";
     else if( value==Modality.OAM )
         return "OAM";
     else if( value==Modality.OCT )
         return "OCT";
     else if( value==Modality.OP )
         return "OP";
     else if( value==Modality.OPM )
         return "OPM";
     else if( value==Modality.OPT )
         return "OPT";
     else if( value==Modality.OPV )
         return "OPV";
     else if( value==Modality.OT )
         return "OT";
     else if( value==Modality.PR )
         return "PR";
     else if( value==Modality.PT )
         return "PT";
     else if( value==Modality.PX )
         return "PX";
     else if( value==Modality.REG )
         return "REG";
     else if( value==Modality.RF )
         return "RF";
     else if( value==Modality.RG )
         return "RG";
     else if( value==Modality.RTDOSE )
         return "RTDOSE";
     else if( value==Modality.RTIMAGE )
         return "RTIMAGE";
     else if( value==Modality.RTPLAN )
         return "RTPLAN";
     else if( value==Modality.RTRECORD )
         return "RTRECORD";
     else if( value==Modality.RTSTRUCT )
         return "RTSTRUCT";
     else if( value==Modality.SEG )
         return "SEG";
     else if( value==Modality.SM )
         return "SM";
     else if( value==Modality.SMR )
         return "SMR";
     else if( value==Modality.SR )
         return "SR";
     else if( value==Modality.SRF )
         return "SRF";
     else if( value==Modality.TG )
         return "TG";
     else if( value==Modality.US )
         return "US";
     else if( value==Modality.VA )
         return "VA";
     else if( value==Modality.XA )
         return "XA";
     else if( value==Modality.XC )
         return "XC";
     else
         throw new ArgumentException("Unrecognized Modality value: " + value.ToString());
 }
        public void Test_GetRelatedProcedureSteps()
        {
            Procedure p1 = new Procedure();
            string description = "description.";
            Modality modality = new Modality();

            // attach 2 procedure steps to p1
            ModalityProcedureStep ps11 = new ModalityProcedureStep(p1, description, modality);
            ModalityProcedureStep ps12 = new ModalityProcedureStep(p1, description, modality);

            // expect that each ps is only related to itself
            Assert.IsEmpty(ps11.GetRelatedProcedureSteps());
            Assert.IsEmpty(ps12.GetRelatedProcedureSteps());
        }
Exemple #34
0
		protected VolumeData CreateVolume(bool signed, Modality modality, Vector3D voxelSpacing)
		{
			Vector3D originPatient = new Vector3D(0, 0, 0);
			Matrix orientationPatient = Matrix.GetIdentity(4);
			int width, height, depth;
			if (signed)
			{
				short[] data = CreateSignedArray(out width, out height, out depth, voxelSpacing);
				DicomAttributeCollection dataset = CreateMockDataset(_name, _studyInstanceUid, _frameOfReferenceUid, modality, width, height, true, new SizeF(voxelSpacing.X, voxelSpacing.Y));
				Size3D dimensions = new Size3D(width, height, depth);
				return new VolumeData(data, dimensions, voxelSpacing, originPatient, orientationPatient, dataset, short.MinValue);
			}
			else
			{
				ushort[] data = CreateUnsignedArray(out width, out height, out depth, voxelSpacing);
				DicomAttributeCollection dataset = CreateMockDataset(_name, _studyInstanceUid, _frameOfReferenceUid, modality, width, height, false, new SizeF(voxelSpacing.X, voxelSpacing.Y));
				Size3D dimensions = new Size3D(width, height, depth);
				return new VolumeData(data, dimensions, voxelSpacing, originPatient, orientationPatient, dataset, ushort.MinValue);
			}
		}
        public void RegisterParticipant_ExistingParticipantAndPHSEventWithPreRegistration()
        {
            ParticipantJourneySearchViewModel psm = new ParticipantJourneySearchViewModel();

            psm.Nric       = "S8250369B";
            psm.PHSEventId = 2;

            PHSEvent phsEventOne = new PHSEvent()
            {
                Title    = "Test 15",
                Venue    = "Test",
                StartDT  = DateTime.Now.AddDays(-200),
                EndDT    = DateTime.Now.AddDays(-199),
                IsActive = false
            };

            PHSEvent phsEventTwo = new PHSEvent()
            {
                Title    = "Test 16",
                Venue    = "Test",
                StartDT  = DateTime.Now.AddDays(-2),
                EndDT    = DateTime.Now.AddDays(1),
                IsActive = true
            };

            Participant participant = new Participant()
            {
                Nric        = "S8250369B",
                DateOfBirth = DateTime.Now,
                HomeNumber  = "88776655"
            };

            PreRegistration preRegistration = new PreRegistration()
            {
                Nric        = "S8250369B",
                Address     = "Test Add",
                Citizenship = "Singaporean",
                HomeNumber  = "12345678",
                FullName    = "Tester",
                Gender      = "Male",
                Salutation  = "Mr",
                Race        = "Chinese",
                Language    = "English",
                DateOfBirth = DateTime.Now,
                EntryId     = Guid.NewGuid()
            };

            Modality modality = new Modality()
            {
                Name        = "Test Modality",
                IsMandatory = true
            };

            Form form = new Form
            {
                Title = "Test form"
            };


            _unitOfWork.PreRegistrations.Add(preRegistration);

            _unitOfWork.Events.Add(phsEventOne);
            _unitOfWork.Events.Add(phsEventTwo);

            participant.PHSEvents.Add(phsEventOne);

            _unitOfWork.Participants.Add(participant);

            modality.Forms.Add(form);

            phsEventTwo.Modalities.Add(modality);

            _unitOfWork.Complete();

            string      message     = string.Empty;
            MessageType messageType = MessageType.ERROR;

            ParticipantJourneyViewModel preResult = _target.RetrieveParticipantJourney(psm, out message, out messageType);

            Assert.IsNull(preResult);

            string registerResult = _target.RegisterParticipant(psm);

            Assert.AreEqual("success", registerResult);

            ParticipantJourneyViewModel postResult = _target.RetrieveParticipantJourney(psm, out message, out messageType);

            Assert.IsNotNull(postResult);
            Assert.IsNotNull(postResult.Event);

            Assert.AreEqual("12345678", postResult.HomeNumber);

            var pjmResult = _unitOfWork.ParticipantJourneyModalities.Find(u => u.PHSEventID == postResult.Event.PHSEventID).FirstOrDefault();

            Assert.IsNotNull(pjmResult);
            Assert.AreEqual(1, pjmResult.ParticipantID);
            Assert.AreEqual(1, pjmResult.ModalityID);
            Assert.AreEqual(2, pjmResult.PHSEventID);
            Assert.AreEqual(1, pjmResult.FormID);
        }
            public static bool TryParse(string value, out Modality result)
            {
                result = default(Modality);

                if( value=="AR")
                    result = Modality.AR;
                else if( value=="AU")
                    result = Modality.AU;
                else if( value=="BDUS")
                    result = Modality.BDUS;
                else if( value=="BI")
                    result = Modality.BI;
                else if( value=="BMD")
                    result = Modality.BMD;
                else if( value=="CR")
                    result = Modality.CR;
                else if( value=="CT")
                    result = Modality.CT;
                else if( value=="DG")
                    result = Modality.DG;
                else if( value=="DX")
                    result = Modality.DX;
                else if( value=="ECG")
                    result = Modality.ECG;
                else if( value=="EPS")
                    result = Modality.EPS;
                else if( value=="ES")
                    result = Modality.ES;
                else if( value=="GM")
                    result = Modality.GM;
                else if( value=="HC")
                    result = Modality.HC;
                else if( value=="HD")
                    result = Modality.HD;
                else if( value=="IO")
                    result = Modality.IO;
                else if( value=="IVOCT")
                    result = Modality.IVOCT;
                else if( value=="IVUS")
                    result = Modality.IVUS;
                else if( value=="KER")
                    result = Modality.KER;
                else if( value=="KO")
                    result = Modality.KO;
                else if( value=="LEN")
                    result = Modality.LEN;
                else if( value=="LS")
                    result = Modality.LS;
                else if( value=="MG")
                    result = Modality.MG;
                else if( value=="MR")
                    result = Modality.MR;
                else if( value=="NM")
                    result = Modality.NM;
                else if( value=="OAM")
                    result = Modality.OAM;
                else if( value=="OCT")
                    result = Modality.OCT;
                else if( value=="OP")
                    result = Modality.OP;
                else if( value=="OPM")
                    result = Modality.OPM;
                else if( value=="OPT")
                    result = Modality.OPT;
                else if( value=="OPV")
                    result = Modality.OPV;
                else if( value=="OT")
                    result = Modality.OT;
                else if( value=="PR")
                    result = Modality.PR;
                else if( value=="PT")
                    result = Modality.PT;
                else if( value=="PX")
                    result = Modality.PX;
                else if( value=="REG")
                    result = Modality.REG;
                else if( value=="RF")
                    result = Modality.RF;
                else if( value=="RG")
                    result = Modality.RG;
                else if( value=="RTDOSE")
                    result = Modality.RTDOSE;
                else if( value=="RTIMAGE")
                    result = Modality.RTIMAGE;
                else if( value=="RTPLAN")
                    result = Modality.RTPLAN;
                else if( value=="RTRECORD")
                    result = Modality.RTRECORD;
                else if( value=="RTSTRUCT")
                    result = Modality.RTSTRUCT;
                else if( value=="SEG")
                    result = Modality.SEG;
                else if( value=="SM")
                    result = Modality.SM;
                else if( value=="SMR")
                    result = Modality.SMR;
                else if( value=="SR")
                    result = Modality.SR;
                else if( value=="SRF")
                    result = Modality.SRF;
                else if( value=="TG")
                    result = Modality.TG;
                else if( value=="US")
                    result = Modality.US;
                else if( value=="VA")
                    result = Modality.VA;
                else if( value=="XA")
                    result = Modality.XA;
                else if( value=="XC")
                    result = Modality.XC;
                else
                    return false;

                return true;
            }
 public void SetModality(Modality input_modality)
 {
     _modality = input_modality;
 }