simnibs.NodeData

class simnibs.NodeData(value, name='', mesh=None)

Data (scalar, vector or tensor) defined in mesh nodes.

Parameters:
  • value (ndarray) –

    Value of field in nodes. Should have the shape
    • (n_nodes,) or (n_nodes, 1) for scalar fields

    • (n_nodes, 3) for vector fields

    • (n_nodes, 9) for tensors

  • field_name (str (optional)) – name of field. Default: ‘’

  • mesh (simnibs.msh.Msh (optinal)) – Mesh where the field is defined. Required for many methods

value

Value of field in elements

Type:

ndarray

field_name

name of field

Type:

str

node_number

index of elements

Type:

ndarray

nr

number of data points

Type:

property

nr_comp

number of dimensions per data point (1 for scalars, 3 for vectors)

Type:

property

__init__(value, name='', mesh=None)

Methods

__init__(value[, name, mesh])

angle([fill])

Calculate the angle between the field and the surface normal

append_to_mesh(fn[, mode, mmg_fix])

Appends this NodeData fields to a file

as_nodedata()

calc_flux([nodes])

Calculates the flux of a vector field though the given nodes

from_data_grid(mesh, data_grid, affine[, ...])

Defines an NodeData field from a mesh and gridded data

get_focality([cuttofs, peak_percentile])

Caluclates field focality as the area/volume of the mesh experiencing a field magnitude of above (cut_off% of the field peak).

get_percentiles([percentile, roi])

Get percentiles of field (or field magnitude, if a vector field)

gradient()

Calculates the gradient of a field in the middle of the tetrahedra

interpolate_scattered(points[, out_fill, ...])

Interpolates the NodeaData into the points by finding the element containing the point and performing linear interpolation inside the element

interpolate_to_grid(n_voxels, affine, **kwargs)

Interpolates the NodeData into a grid.

interpolate_to_grid_max(n_voxels, affine[, ...])

Interpolates the NodeData into a grid.

interpolate_to_surface(surface[, out_fill, ...])

Interpolates the field in the nodes of a given surface The interpolation occurs in the tetrahedra!

mean_field_norm()

Calculates V*w/sum(w) Where V is the magnitude of the field, and w is the volume or area of the mesh where the field is defined.

node_data2elm_data()

Transforms an ElementData field into a NodeData field the value in the element is the average of the value in the nodes

norm([ord])

Calculate the norm (magnitude) of the field

normal([fill])

Calculate the normal component of the field in the mesh surfaces

read_hdf5_data_matrix_row(leadfield_fn, ...)

Reads a row of an hdf5 data matrix and store it as Data

summary([percentiles, focality_cutoffs, units])

Creates a text summary of the field

tangent([fill])

Calculate the tangent component of the field in the surfaces

to_deformed_grid(warp, reference[, out, ...])

Interpolates field to a grid and apply non-linear interpolation

to_nifti(n_voxels, affine[, fn, units, ...])

Transforms the data in a nifti file

view_options([v_range, percentile, visible, ...])

Generates a View object with visualization opions

write(fn)

Writes this NodeData field to a file with field information only This file needs to be merged with a mesh for visualization

write_hdf5(hdf5_fn[, path])

Writes the field to an hdf5 file

Attributes

indexing_nr

Same as node_numbers

node_number

Node numbers (1, ..., nr)

nr

Number of data entries

nr_comp

Number of field components

type

NodeData of ElementData