Beispiel #1
0
def reslice_image_set(in_files, image_shape, label_indices=None, crop=False):
    if crop:
        crop_slices = get_cropping_parameters([in_files])
    else:
        crop_slices = None
    images = read_image_files(image_files=in_files,
                              image_shape=image_shape,
                              crop=crop_slices,
                              label_indices=label_indices)
    return images
Beispiel #2
0
def reslice_image_set(in_files, image_shape, out_files=None, label_indices=None, crop=False):
    if crop:
        crop_slices = get_cropping_parameters([in_files])
    else:
        crop_slices = None
    images = read_image_files(in_files, image_shape=image_shape, crop=crop_slices, label_indices=label_indices)
    if out_files:
        for image, out_file in zip(images, out_files):
            image.to_filename(out_file)
        return [os.path.abspath(out_file) for out_file in out_files]
    else:
        return images
Beispiel #3
0
def write_image_data_to_file(image_files,
                             data_storage,
                             truth_storage,
                             image_shape,
                             n_channels,
                             crop=None,
                             truth_dtype=np.uint8):
    for set_of_files in image_files:
        subject_data = read_image_files(set_of_files, image_shape, crop=crop)
        data_storage.append(subject_data[:n_channels][np.newaxis])
        truth_storage.append(
            np.asarray(subject_data[n_channels][np.newaxis][np.newaxis],
                       dtype=truth_dtype))
    return data_storage, truth_storage
def reslice_image_set(in_files,
                      image_shape,
                      out_files=None,
                      label_indices=None,
                      crop=False):
    if crop:
        crop_slices = get_cropping_parameters([in_files])
    else:
        crop_slices = None
    images = read_image_files(in_files,
                              image_shape=image_shape,
                              crop=crop_slices,
                              label_indices=label_indices)
    if out_files:
        for image, out_file in zip(images, out_files):
            image.to_filename(out_file)
        #return [os.path.abspath(out_file) for out_file in out_files]
        return [
            os.path.join('/home/vjain/notebooks/3DUnetCNN/brats/', out_file)
            for out_file in out_files
        ]
    else:
        return images