public void Initialize(ITissue tissue, Random rng) { // assign any user-defined outputs (except arrays...we'll make those on-demand) TallyCount = 0; // if the data arrays are null, create them (only create second moment if TallySecondMoment is true) Mean = Mean ?? new double[X.Count - 1, Y.Count - 1, Z.Count - 1, Time.Count - 1]; SecondMoment = SecondMoment ?? (TallySecondMoment ? new double[X.Count - 1, Y.Count - 1, Z.Count - 1, Time.Count - 1] : null); // intialize any other necessary class fields here _absorptionWeightingMethod = AbsorptionWeightingMethods.GetVolumeAbsorptionWeightingMethod(tissue, this); _tissue = tissue; _ops = _tissue.Regions.Select(r => r.RegionOP).ToArray(); _tallyForOnePhoton = _tallyForOnePhoton ?? (TallySecondMoment ? new double[X.Count - 1, Y.Count - 1, Z.Count - 1, Time.Count - 1] : null); }
public void Initialize(ITissue tissue, Random rng) { // assign any user-defined outputs (except arrays...we'll make those on-demand) TallyCount = 0; // if the data arrays are null, create them (only create second moment if TallySecondMoment is true) //Mean = Mean ?? new double(); //SecondMoment = SecondMoment ?? (TallySecondMoment ? new double() : null); Mean = new double(); if (TallySecondMoment) { SecondMoment = new double(); } // intialize any other necessary class fields here _absorptionWeightingMethod = AbsorptionWeightingMethods.GetVolumeAbsorptionWeightingMethod(tissue, this); _tissue = tissue; _boundingVolumeOPs = _tissue.Regions[_tissue.Regions.Count - 1].RegionOP; }