def volume_to_vector_array_to_obj_file( image, output_path, voxel_size=50, step_size=1, threshold=0, deal_with_regions_separately=False, ): if deal_with_regions_separately: for label_id in np.unique(image): if label_id != 0: filename = append_to_pathlib_stem( Path(output_path), "_" + str(label_id) ) image = image == label_id extract_and_save_object( image, filename, voxel_size, threshold=threshold, step_size=step_size, ) else: extract_and_save_object( image, output_path, voxel_size, threshold=threshold, step_size=step_size, )
def volume_to_vector_array_to_obj_file( image, output_path, invert_axes=[2], voxel_size=10, orientation="coronal", step_size=1, threshold=0, deal_with_regions_separately=False, ): oriented_binary = reorient_image( image, invert_axes=invert_axes, orientation=orientation ) if deal_with_regions_separately: for label_id in np.unique(oriented_binary): if label_id != 0: filename = append_to_pathlib_stem( Path(output_path), "_" + str(label_id) ) image = oriented_binary == label_id extract_and_save_object( image, filename, voxel_size=voxel_size, threshold=threshold, step_size=step_size, ) else: extract_and_save_object( oriented_binary, output_path, voxel_size=voxel_size, threshold=threshold, step_size=step_size, )