kwneuro.io ========== .. py:module:: kwneuro.io Classes ------- .. autoapisummary:: kwneuro.io.NiftiVolumeResource kwneuro.io.FslBvalResource kwneuro.io.FslBvecResource kwneuro.io.JsonResponseFunctionResource Module Contents --------------- .. py:class:: NiftiVolumeResource Bases: :py:obj:`kwneuro.resource.VolumeResource` A volume or volume stack that is saved to disk in the nifti file format. .. py:attribute:: is_loaded :type: ClassVar[bool] :value: False Whether a resource corresponds to in-memory data, rather than for example on-disk data. .. py:attribute:: path_in :type: dataclasses.InitVar[kwneuro.util.PathLike] Path to the underlying volume nifti file .. py:attribute:: path :type: pathlib.Path .. py:method:: load() -> kwneuro.resource.InMemoryVolumeResource Load volume into memory .. py:method:: get_array() -> numpy.typing.NDArray[numpy.number] Get the underlying volume data array .. py:method:: get_affine() -> numpy.typing.NDArray[numpy.floating] Get the 4x4 affine matrix that maps index space to patient/scanner space .. py:method:: get_metadata() -> dict[str, Any] Get the volume image metadata .. py:method:: save(vol: kwneuro.resource.VolumeResource, path: kwneuro.util.PathLike) -> NiftiVolumeResource :staticmethod: Save volume data to a path, creating a NiftiVolumeResource. .. py:class:: FslBvalResource Bases: :py:obj:`kwneuro.resource.BvalResource` A b-value list that is saved to disk in the FSL text file format. .. py:attribute:: is_loaded :type: ClassVar[bool] :value: False Whether a resource corresponds to in-memory data, rather than for example on-disk data. .. py:attribute:: path_in :type: dataclasses.InitVar[kwneuro.util.PathLike] Path to the underlying bval txt file .. py:attribute:: path :type: pathlib.Path .. py:method:: load() -> kwneuro.resource.InMemoryBvalResource Load b-values into memory .. py:method:: get() -> numpy.typing.NDArray[numpy.floating] Get the underlying array of b-values .. py:method:: save(bvals: kwneuro.resource.BvalResource, path: kwneuro.util.PathLike) -> FslBvalResource :staticmethod: Save data to a path, creating a FslBvalResource. .. py:class:: FslBvecResource Bases: :py:obj:`kwneuro.resource.BvecResource` A b-vector list that is saved to disk in the FSL text file format. .. py:attribute:: is_loaded :type: ClassVar[bool] :value: False Whether a resource corresponds to in-memory data, rather than for example on-disk data. .. py:attribute:: path_in :type: dataclasses.InitVar[kwneuro.util.PathLike] Path to the underlying bvec txt file .. py:attribute:: path :type: pathlib.Path .. py:method:: load() -> kwneuro.resource.InMemoryBvecResource Load b-vectors into memory .. py:method:: get() -> numpy.typing.NDArray[numpy.floating] Get the underlying array of b-vectors of shape (N,3) .. py:method:: save(bvecs: kwneuro.resource.BvecResource, path: kwneuro.util.PathLike) -> FslBvecResource :staticmethod: Save data to a path, creating a FslBvecResource. .. py:class:: JsonResponseFunctionResource Bases: :py:obj:`kwneuro.resource.ResponseFunctionResource` A response function that is saved to disk in a json file. .. py:attribute:: is_loaded :type: ClassVar[bool] :value: False Whether a resource corresponds to in-memory data, rather than for example on-disk data. .. py:attribute:: path_in :type: dataclasses.InitVar[kwneuro.util.PathLike] Path to the underlying json file .. py:attribute:: path :type: pathlib.Path .. py:method:: get() -> tuple[numpy.typing.NDArray, numpy.floating] Get the underlying response function .. py:method:: get_dipy_object() -> dipy.reconst.csdeconv.AxSymShResponse Get the underlying response function in a format compatible with Dipy .. py:method:: load() -> kwneuro.resource.InMemoryResponseFunctionResource Load volume into memory .. py:method:: save(response: kwneuro.resource.ResponseFunctionResource, path: kwneuro.util.PathLike) -> JsonResponseFunctionResource :staticmethod: Save response function data to a path, creating a JsonResponseFunctionResource.