File IO#

swick.read_swc()#

Reads an .swc file to create and return an SWC object.

Parameters:

path – the path to the .swc file to be read

Returns:

an SWC object containing the loaded data

Raises:

SWCFormatError – if the file does not adhere to the SWC format

swick.write_swc()#

Writes an SWC object into an .swc file.

Parameters:
  • path – the path to the .swc file to be written

  • swc – the SWC object to be written to a file

  • delimeter – separator for fields (tabs and spaces only)

  • decimal_places – number of decimal places written for floats; if -1, uses as many as necessary for each field

Returns:

an SWC object containing the data to be written

Raises:
  • ValueError – if delimeter or decimal_places values are invalid

  • SWCFormatError – if the SWC object is invalid