public void validate_deserialized_class_is_correct() { var i = new SingleVoxelTissueInput( new VoxelTissueRegion( new DoubleRange(-1, 1), new DoubleRange(-1, 1), new DoubleRange(1, 2), new OpticalProperties(0.05, 1.0, 0.8, 1.4)), new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, 100.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(100.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ); var iCloned = i.Clone(); Assert.AreEqual(iCloned.Regions[1].RegionOP.Mua, i.Regions[1].RegionOP.Mua); }
public void validate_deserialized_class_is_correct_when_using_FileIO() { var i = new SingleVoxelTissueInput( new VoxelTissueRegion( new DoubleRange(-1, 1), new DoubleRange(-1, 1), new DoubleRange(1, 2), new OpticalProperties(0.05, 1.0, 0.8, 1.4)), new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, 100.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(100.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ); i.WriteToJson("SingleVoxelTissue.txt"); var iCloned = FileIO.ReadFromJson <SingleVoxelTissueInput>("SingleVoxelTissue.txt"); Assert.AreEqual(iCloned.Regions[1].RegionOP.Mua, i.Regions[1].RegionOP.Mua); }
public void verify_default_constructor_sets_properties_correctly() { ITissueInput tissueInput; // verify MultiLayerTissueInput tissueInput = new MultiLayerTissueInput(); var viewModel = new MultiRegionTissueViewModel(tissueInput); Assert.IsTrue(viewModel.RegionsVM != null); var listOfTissueRegions = viewModel.RegionsVM; Assert.IsTrue(((LayerRegionViewModel)listOfTissueRegions[1]).IsLayer); // verify SingleEllipsoidTissueInput tissueInput = new SingleEllipsoidTissueInput(); viewModel = new MultiRegionTissueViewModel(tissueInput); Assert.IsTrue(viewModel.RegionsVM != null); listOfTissueRegions = viewModel.RegionsVM; Assert.IsTrue(((EllipsoidRegionViewModel)listOfTissueRegions[3]).IsEllipsoid); // verify SingleVoxelTissueInput tissueInput = new SingleVoxelTissueInput(); viewModel = new MultiRegionTissueViewModel(tissueInput); Assert.IsTrue(viewModel.RegionsVM != null); listOfTissueRegions = viewModel.RegionsVM; Assert.IsTrue(((VoxelRegionViewModel)listOfTissueRegions[3]).IsVoxel); }