opengate.image ============== .. py:module:: opengate.image Functions --------- .. autoapisummary:: opengate.image.update_image_py_to_cpp opengate.image.itk_dir_to_rotation opengate.image.create_3d_image opengate.image.create_image_like opengate.image.create_image_like_info opengate.image.get_info_from_image opengate.image.read_image_info opengate.image.get_translation_between_images_center opengate.image.get_origin_wrt_images_g4_position opengate.image.get_cpp_image opengate.image.itk_image_view_from_array opengate.image.get_image_center opengate.image.get_translation_from_iso_center opengate.image.align_image_with_physical_volume opengate.image.create_image_with_extent opengate.image.create_image_with_volume_extent opengate.image.voxelize_volume opengate.image.transform_images_point opengate.image.compute_image_3D_CDF opengate.image.scale_itk_image opengate.image.divide_itk_images opengate.image.split_spect_projections opengate.image.compare_itk_image_info opengate.image.compare_itk_image_content opengate.image.compare_itk_image Module Contents --------------- .. py:function:: update_image_py_to_cpp(py_img, cpp_img, copy_data=False) .. py:function:: itk_dir_to_rotation(dir) .. py:function:: create_3d_image(size, spacing, pixel_type='float', allocate=True, fill_value=0) .. py:function:: create_image_like(like_image, allocate=True, pixel_type='') .. py:function:: create_image_like_info(info, allocate=True) .. py:function:: get_info_from_image(image) .. py:function:: read_image_info(path_to_image) .. py:function:: get_translation_between_images_center(img_name1, img_name2) The two images are considered in the same physical space (coordinate system). This function computes the translation between their centers. Warning, the ITK image origin consider the center of the first voxel, we thus consider half a pixel shift for the center. .. py:function:: get_origin_wrt_images_g4_position(img_info1, img_info2, translation) The two images are considered in the same GATE physical space (coordinate system), so according to the centers of both images (+translation). This function computes the origin for the second image such as the two images will be in the same physical space of the first image. Warning, the ITK image origin considers the center of the first voxel, we thus consider half a pixel shift for the center. .. py:function:: get_cpp_image(cpp_image) .. py:function:: itk_image_view_from_array(arr) When the input numpy array is of shape [1,1,x], the conversion to itk image fails: the output image size is with the wrong dimensions. We thus 'patch' itk.image_view_from_array to correct the size. Not fully sure if this is the way to go. .. py:function:: get_image_center(image) .. py:function:: get_translation_from_iso_center(img_info, rot, iso_center, centered) .. py:function:: align_image_with_physical_volume(volume, image, initial_translation=None, initial_rotation=Rotation.identity(), copy_index=0) .. py:function:: create_image_with_extent(extent, spacing=(1, 1, 1), margin=0) .. py:function:: create_image_with_volume_extent(volume, spacing=(1, 1, 1), margin=0) .. py:function:: voxelize_volume(se, image) The voxelization do not check which volume is voxelized. Every voxel will be assigned an ID corresponding to the material at this position in the world. .. py:function:: transform_images_point(p, img1, img2) .. py:function:: compute_image_3D_CDF(image) Compute the three CDF (Cumulative Density Function) for the given image Warning; numpy order is ZYX :param image: itk image .. py:function:: scale_itk_image(img, scale) .. py:function:: divide_itk_images(img1_numerator, img2_denominator, filterVal=0, replaceFilteredVal=0) .. py:function:: split_spect_projections(input_filenames, nb_ene) The inputs are filenames of several images containing projections for a given spect head Each image is composed of nb_ene energy windows and XX angles. The number of angles is found by looking at the number of slices. The function computes nb_ene itk image with all angles and all heads merged into a list of projections stored as a 3D image, to make it easy to reconstruct with RTK. .. py:function:: compare_itk_image_info(image1, image2) .. py:function:: compare_itk_image_content(image1, image2) .. py:function:: compare_itk_image(filename1, filename2)