Parsing NRRD fields
Parse number from string with automatic type detection. |
|
|
Parse NRRD number list from string into (N,) |
|
Parse NRRD vector from string into (N,) |
|
Parse optional NRRD vector from string into (N,) |
|
Parse NRRD matrix from string into (M,N) |
Parse optional NRRD matrix from string into (M,N) |
|
|
Parse NRRD vector list from string into a |
|
Parse optional NRRD vector list from string into |
- nrrd.parse_matrix(x: str, dtype: Optional[Type[Union[int, float]]] = None) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]
Parse NRRD matrix from string into (M,N)
numpy.ndarray.See int matrix and double matrix for more information on the format.
- Parameters
- x
str String containing NRRD matrix
- dtypedata-type, optional
Datatype to use for the resulting Numpy array. Datatype can be
float,intorNone. IfdtypeisNone, then it will be automatically determined by checking any of the elements for fractional numbers. If found, then the matrix will be converted tofloat, otherwiseint. Default is to automatically determine datatype.
- x
- Returns
- matrix(M,N)
numpy.ndarray Matrix that is parsed from the
xstring
- matrix(M,N)
- nrrd.parse_number_auto_dtype(x: str) Union[int, float][source]
Parse number from string with automatic type detection.
Parses input string and converts to a number using automatic type detection. If the number contains any fractional parts, then the number will be converted to float, otherwise the number will be converted to an int.
- nrrd.parse_number_list(x: str, dtype: Optional[Type[Union[int, float]]] = None) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]
Parse NRRD number list from string into (N,)
numpy.ndarray.See int list and double list for more information on the format.
- Parameters
- x
str String containing NRRD number list
- dtypedata-type, optional
Datatype to use for the resulting Numpy array. Datatype can be
float,intorNone. IfdtypeisNone, then it will be automatically determined by checking for fractional numbers. If found, then the string will be converted tofloat, otherwiseint. Default is to automatically determine datatype.
- x
- Returns
- vector(N,)
numpy.ndarray Vector that is parsed from the
xstring
- vector(N,)
- nrrd.parse_optional_matrix(x: str) Optional[ndarray[tuple[int, ...], dtype[_ScalarType_co]]][source]
Parse optional NRRD matrix from string into (M,N)
numpy.ndarrayoffloat.Function parses optional NRRD matrix from string into an (M,N)
numpy.ndarrayoffloat. This function works the same asparse_matrix()except if a row vector in the matrix is none, the resulting row in the returned matrix will be all NaNs.See double matrix for more information on the format.
- Parameters
- x
str String containing NRRD matrix
- x
- Returns
- matrix(M,N)
numpy.ndarrayoffloat Matrix that is parsed from the
xstring
- matrix(M,N)
- nrrd.parse_optional_vector(x: str, dtype: Optional[Type[Union[int, float]]] = None) Optional[ndarray[tuple[int, ...], dtype[_ScalarType_co]]][source]
Parse optional NRRD vector from string into (N,)
numpy.ndarrayorNone.Function parses optional NRRD vector from string into an (N,)
numpy.ndarray. This function works the same asparse_vector()except ifxis ‘none’,vectorwill beNoneSee int vector and double vector for more information on the format.
- Parameters
- x
str String containing NRRD vector or ‘none’
- dtypedata-type, optional
Datatype to use for the resulting Numpy array. Datatype can be
float,intorNone. IfdtypeisNone, then it will be automatically determined by checking any of the vector elements for fractional numbers. If found, then the vector will be converted tofloat, otherwiseint. Default is to automatically determine datatype.
- x
- Returns
- vector(N,)
numpy.ndarrayorNone Vector that is parsed from the
xstring orNoneifxis ‘none’
- vector(N,)
- nrrd.parse_optional_vector_list(x: str, dtype: Optional[Type[Union[int, float]]] = None) List[Optional[ndarray[tuple[int, ...], dtype[_ScalarType_co]]]][source]
Parse optional NRRD vector list from string into
listof (N,)numpy.ndarrayoffloat.Function parses optional NRRD vector list from string into a list of (N,)
numpy.ndarrayorNone. This function works the same asparse_vector_list()except if a row vector in the list is none, the resulting row in the returned list will beNone.See int vector list and double vector list for more information on the format.
- Parameters
- x
str String containing NRRD vector list
- x
- Returns
- vector_list
listof (N,)numpy.ndarrayorNone List of vectors that is parsed from the
xstring
- vector_list
- nrrd.parse_vector(x: str, dtype: Optional[Type[Union[int, float]]] = None) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]
Parse NRRD vector from string into (N,)
numpy.ndarray.See int vector and double vector for more information on the format.
- Parameters
- x
str String containing NRRD vector
- dtypedata-type, optional
Datatype to use for the resulting Numpy array. Datatype can be
float,intorNone. IfdtypeisNone, then it will be automatically determined by checking any of the vector elements for fractional numbers. If found, then the vector will be converted tofloat, otherwiseint. Default is to automatically determine datatype.
- x
- Returns
- vector(N,)
numpy.ndarray Vector that is parsed from the
xstring
- vector(N,)
- nrrd.parse_vector_list(x: str, dtype: Optional[Type[Union[int, float]]] = None) List[ndarray[tuple[int, ...], dtype[_ScalarType_co]]][source]
Parse NRRD vector list from string into a
listof (N,)numpy.ndarray.Parses input string to convert it into a list of Numpy arrays using the NRRD vector list format.
See int vector list and double vector list for more information on the format.
- Parameters
- x
str String containing NRRD vector list
- dtypedata-type, optional
Datatype to use for the resulting Numpy arrays. Datatype can be
float,intorNone. IfdtypeisNone, it will be automatically determined by checking any of the vector elements for fractional numbers. If found, the vectors will be converted tofloat, otherwiseint. Default is to automatically determine datatype.
- x
- Returns
- vector_list
listof (N,)numpy.ndarray List of vectors that are parsed from the
xstring
- vector_list