niftynet.io.image_reader module

This module loads images from csv files and outputs numpy arrays

class niftynet.io.image_reader.ImageReader(names)

Bases: niftynet.layer.base_layer.Layer

For a concrete example: _input_sources define multiple modality mappings, e.g., _input_sources {‘image’: (‘T1’, ‘T2’),

‘label’: (‘manual_map’,)}

means ‘image’ consists of two components, formed by concatenating ‘T1’ and ‘T2’ input source images. ‘label’ consists of one component, loading from ‘manual_map’

self._names: a tuple of the output names of this reader. (‘image’, ‘labels’)

self._shapes: the shapes after combining input sources {‘image’: (192, 160, 192, 1, 2), ‘label’: (192, 160, 192, 1, 1)}

self._dtypes: store the dictionary of tensorflow shapes {‘image’: tf.float32, ‘label’: tf.float32}

self.output_list is a list of dictionaries, with each item: {‘image’: <niftynet.io.image_type.SpatialImage4D object>,

‘label’: <niftynet.io.image_type.SpatialImage3D object>}
add_preprocessing_layers(layers)
get_subject_id(image_index)
initialise_reader(data_param, task_param)

task_param specifies how to combine user input modalities e.g., for multimodal segmentation ‘image’ corresponds to multiple modality sections, ‘label’ corresponds to one modality section

input_sources
layer_op(idx=None, shuffle=True)
this layer returns a dictionary
keys: self.output_fields values: image volume array
names
prepare_preprocessors()
shapes

image shapes before any preprocessing :return: tuple of integers as image shape

tf_dtypes
niftynet.io.image_reader.infer_tf_dtypes(image_array)