Example #1
0
tissue_name_orig = AVW_Data.tissue_names
tissue_mapping = AVW_Data.tissue_mapping

Donna = VoxelModel()
Donna.show_progress_bar = True

# needs to be set manually from README.txt
Donna.set_scale(1.875, 1.875, 10)

Donna.name = 'Donna'
Donna.description = 'Donna model from the Helmholtz Zentrum München. ' \
                    'Resolution %.2fmm x %.2fmm x %.2fmm' % (Donna.scaling.x,
                                                             Donna.scaling.y, Donna.scaling.z)

#  Calculate the outer_shape of the original and the complete model
outer_shape = AVW_Data.calculate_outer_shape(model_orig, tissue_mapping)

Donna.add_voxel_data(short_name='original',
                     name='Original data from AVW file',
                     model=model_orig,
                     outer_shape=outer_shape,
                     tissue_names=tissue_name_orig)

Donna.add_voxel_data(
    short_name='complete',
    name='The \'original\' model converted to our TissueProperties.',
    model=Donna.models['original'].data,
    outer_shape=outer_shape,
    tissue_mapping=tissue_mapping)

# Calculate the trunk model
txt_data = VoxelModelImporter(txt_files_dir, tissue_mapping_file, 'TXT', show_progress=True)

# the scale of the model in millimeter
scale = txt_data.data['scale']
AustinMan.set_scale(scale['x'], scale['y'], scale['z'])
# the original voxel model
model_orig = txt_data.data['image']
# the tissue names
tissue_name_orig = txt_data.tissue_names
tissue_mapping = txt_data.tissue_mapping

"""
#The original model
"""
# Calculate the outer_shape
outer_shape = txt_data.calculate_outer_shape(model_orig, tissue_mapping)

# store the original human body model
AustinMan.add_voxel_data(short_name='original',
                         name='The original model as imported from the .txt files.',
                         outer_shape=outer_shape,
                         model=model_orig,
                         tissue_names=tissue_name_orig)
"""
# the complete model
"""
# add the 'complete' model. This is in fact just a pointer to the 'original' model with the tissue_mapping
# which is automatically applied when the model is called in the following way:
#  AustinMan.model['complete'][:, :, slice] gives one horizontal slice of the complete model with our tissue names.
# This is handled by the __getitem__() method of VoxelModelData.
AustinMan.add_voxel_data(short_name='complete',