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) |
- nrrd.parse_matrix(x: str, dtype: Optional[Type[Union[int, float]]] = None) Any] [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
,int
orNone
. Ifdtype
isNone
, 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
x
string
- 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) Any] [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
,int
orNone
. Ifdtype
isNone
, 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
x
string
- vector(N,)
- nrrd.parse_optional_matrix(x: str) Any]] [source]
Parse optional NRRD matrix from string into (M,N)
numpy.ndarray
offloat
.Function parses optional NRRD matrix from string into an (M,N)
numpy.ndarray
offloat
. 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.ndarray
offloat
Matrix that is parsed from the
x
string
- matrix(M,N)
- nrrd.parse_optional_vector(x: str, dtype: Optional[Type[Union[int, float]]] = None) Any]] [source]
Parse optional NRRD vector from string into (N,)
numpy.ndarray
orNone
.Function parses optional NRRD vector from string into an (N,)
numpy.ndarray
. This function works the same asparse_vector()
except ifx
is ‘none’,vector
will beNone
See 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
,int
orNone
. Ifdtype
isNone
, 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
orNone
Vector that is parsed from the
x
string orNone
ifx
is ‘none’
- vector(N,)
- nrrd.parse_vector(x: str, dtype: Optional[Type[Union[int, float]]] = None) Any] [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
,int
orNone
. Ifdtype
isNone
, 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
x
string
- vector(N,)