def dummy_metrics(): """Create a Dict of dummy metric.""" metrics = {'with float': Metric(data=np.array([29., 31., 39., 41., 50.])), 'with int': Metric(data=np.array([99, 100, 101, 102, 103])), 'with nan': Metric(data=np.array([99, np.nan, 101, 102, 103])), 'inconsistent length': Metric(data=np.array([99, 100])), 'with string': Metric(data=np.array([99, "boo!", 101, 102, 103]))} return metrics
def dummy_data_and_labels_2d(): """Create a dummy 2d data with associated 2d label, for testing extract_metric().""" data = Metric(data=np.array([[5, 5], [5, 5]])) labels = np.array([[1, 1], [1, 1]]).T # need to transpose because last dim are labels labels = np.expand_dims(labels, axis=2) # because ndim(label) = ndim(data)+1 # Create label_struc{} label_struc = {0: aggregate_slicewise.LabelStruc(id=0, name='mask')} return data, labels, label_struc
def dummy_data_and_labels(): """Create a dummy data with partial volume effect, with associated mask, for testing extract_metric().""" data = Metric(data=np.array([19., 21., 30., 39., 41.])) # Create 3 labels. The last label has very small volume fraction to assess the efficacy of MAP estimation. labels = np.array([[0., 0., 0.5, 1., 1.], [0.9, 1., 0.5, 0., 0.], [0.1, 0., 0., 0., 0.]]).T # need to transpose because last dim are labels # Create label_struc{} label_struc = {0: aggregate_slicewise.LabelStruc(id=0, name='label_0', map_cluster=0), 1: aggregate_slicewise.LabelStruc(id=1, name='label_1', map_cluster=1), 2: aggregate_slicewise.LabelStruc(id=2, name='label_2', map_cluster=1), 99: aggregate_slicewise.LabelStruc(id=[1, 2], name='label_1,2', map_cluster=None)} return data, labels, label_struc
def dummy_metrics(): """Create a Dict of dummy metric.""" metrics = { 'with float': Metric(data=np.array([29., 31., 39., 41., 50., 51., 59., 62., 70.])), 'with int': Metric(data=np.array([99, 100, 101, 102, 103, 104, 105, 106, 107])), 'with nan': Metric(data=np.array([99, np.nan, 101, 102, 103, 104, 105, 106, 107])), 'inconsistent length': Metric(data=np.array([99, 100])), 'with string': Metric(data=np.array([99, "boo!", 101, 102, 103, 104, 105, 106, 107])), '3D': Metric(data=np.resize( np.array([99, 100, 101, 102, 103, 104, 105, 106, 107]), [4, 5, 9])) } return metrics