def calculate_trunk_model(voxel_model: VoxelModel, model_type: str, z_start: int, z_end: int)\
            -> Tuple[np.ndarray, Dict]:
        """
        Calculate the trunk model
        the slice z_end will not be included in the final model
        :param voxel_model:      the voxel model that is converted to a trunk only model
        :param model_type:      the model_type that is used as basis for the conversion
        :param z_start:         start slice
        :param z_end:           end slice (not included)

        """

        logging.info("Calculate the trunk model..")
        model_trunk = voxel_model.models[model_type][:, :, z_start:z_end]
        model_trunk = voxel_model.remove_arms(model_trunk)

        mask_trunk = {'x': range(0, model_trunk.shape[0]),
                      'y': range(0, model_trunk.shape[1]),
                      'z': range(z_start, z_end)}

        return model_trunk, mask_trunk
Exemple #2
0
AustinWoman.add_voxel_data(
    short_name='complete',
    name="The 'original' model converted to our TissueProperties.",
    outer_shape=outer_shape,
    model=AustinWoman.models['original'].data,
    tissue_mapping=tissue_mapping)
"""
Calculate the trunk model 410:756
"""
z_start = 410
z_end = 756
model_trunk = AustinWoman.models['complete'][:, :, z_start:z_end]
# for the AustinWoman in 2x2x2 a small adjustment has to be made at the following voxels, such that the skin layer
# is continuous and the arms are removed in all z-layers
model_trunk[61, 97:99, 253] = np.array([42, 42])
model_trunk = AustinWoman.remove_arms(model_trunk)
trunk_mask = {
    'x': range(0, model_trunk.shape[0]),
    'y': range(0, model_trunk.shape[1]),
    'z': range(z_start, z_end)
}

outer_shape_trunk = txt_data.calculate_outer_shape(model_trunk)

AustinWoman.add_voxel_data(
    short_name='trunk',
    name="The trunk of the 'complete' model. Arms have been removed using "
    "VoxelModel.remove_arms().",
    outer_shape=outer_shape_trunk,
    model=model_trunk,
    mask=trunk_mask,