:py:mod:`simind_io` =================== .. py:module:: simind_io Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: simind_io.get_header_value simind_io.get_projections_from_single_file simind_io.get_projections simind_io.get_source_detector_distances simind_io.get_meshgrid Attributes ~~~~~~~~~~ .. autoapisummary:: simind_io.relation_dict .. py:data:: relation_dict .. py:function:: get_header_value(list_of_attributes, header, dtype = np.float32, split_substr=':=', split_idx=-1, return_all=False) Finds the first entry in an Interfile with the string ``header`` :param list_of_attributes: Simind data file, as a list of lines. :type list_of_attributes: list[str] :param header: The header looked for :type header: str :param dtype: The data type to be returned corresponding to the value of the header. Defaults to np.float32. :type dtype: type, optional :returns: The value corresponding to the header (header). :rtype: float|str|int .. py:function:: get_projections_from_single_file(headerfile) Gets projection data from a SIMIND header file. :param headerfile: Path to the header file :type headerfile: str :param distance: The units of measurements in the SIMIND file (this is required as input, since SIMIND uses mm/cm but doesn't specify). Defaults to 'cm'. :type distance: str, optional :returns: Simulated SPECT projection data. :rtype: (torch.Tensor[1, Ltheta, Lr, Lz]) .. py:function:: get_projections(headerfiles) Obtains projection PSF data from a list of headerfiles and concatenates them together :param headerfiles: List of length Ld corresponding to all projections at different source-detector distances. :type headerfiles: str | Sequence[str] :returns: Output tensor of PSF data at each source-detector distance :rtype: torch.Tensor[Ld,Lx,Ly] .. py:function:: get_source_detector_distances(resfiles) Obtains the source-detector distance from a list of resfiles :param resfiles: List of .res files (of length Ld) corresponding to each simulated PSF projection :type resfiles: str :returns: List of source-detector distances :rtype: torch.Tensor[Ld] .. py:function:: get_meshgrid(resfiles, device='cpu') Obtains a meshgrid of the x and y coordinates correpsonding to the PSF data simulated :param resfiles: List of .res files (of length Ld) corresponding to each simulated PSF projection :type resfiles: str :param device: Device to place the output projection data on. Defaults to 'cpu'. :type device: str, optional :returns: Meshgrid of x and y coordinates :rtype: tuple[torch.Tensor, torch.Tensor]