/// <summary> /// Method to instantiate a single IDetectorInput. This method is called by /// the method below that instantiates a list of detectors. /// </summary> /// <param name="detectorInput">IEnumerable of IDetectorInput</param> /// <param name="tissue">ITissue</param> /// <param name="rng">random number generator</param> /// <returns>List of IDetector</returns> public static IDetector GetDetector(IDetectorInput detectorInput, ITissue tissue, Random rng) { if (detectorInput == null) { return(null); } var detector = detectorInput.CreateDetector(); detector.Initialize(tissue, rng); return(detector); }
/// <summary> /// Method to validate blood volume fraction input agrees with number of tissue subregions /// </summary> /// <param name="input">detector input in SimulationInput</param> /// <returns></returns> public static ValidationResult ValidateInput(IDetectorInput input, int tissueRegionCount) { // test if blood volume fraction list length agrees with number of tissue regions if (((dynamic)input).BloodVolumeFraction.Count != tissueRegionCount) { return(new ValidationResult( false, "TransmittedDynamicMTOfXAndYAndSubregionHistDetectorInput: blood volume fraction list length needs to match number of tissue subregions", "Modify list of blood volume fraction to agree with tissue regions")); } return(new ValidationResult( true, "TransmittedDynamicMTOfXAndYAndSubregionHistDetectorInput: blood volume fraction list agrees with number of tissue regions")); }
/// <summary> /// Method to validate detector fiber is defined to be on surface of tissue /// </summary> /// <param name="input">detector input in SimulationInput</param> /// <returns></returns> public static ValidationResult ValidateInput(IDetectorInput input) { // test if detector center is not on surface of tissue if (((dynamic)input).Center.Z != 0.0) { return(new ValidationResult( false, "SurfaceFiberDetectorInput: detector needs to be defined to be on surface of tissue", "Modify detector Center Z value to be 0.0")); } return(new ValidationResult( true, "SurfaceDetectorInput: detector needs to be defined to be on surface of tissue")); }
/// <summary> /// Method to validate that only one perturbed region specified /// </summary> /// <param name="input">detector input in SimulationInput</param> /// <returns></returns> public static ValidationResult ValidateInput(IDetectorInput input) { // test if perturbed region indices has only one index if (((dynamic)input).PerturbedRegionsIndices.Count > 1) { return(new ValidationResult( false, "dMCdROfRhodMuaDetectorInput: current capability allows only 1 perturbed region", "Modify list of perturbedRegionIndices to contain only 1 index")); } return(new ValidationResult( true, "dMCdROfRhodMuaDetectorInput: perturbedRegionIndices only has 1 index")); }