write.neuron: Write out a neuron in any of the file formats we know about

Description Usage Arguments Details Value See Also Examples

View source: R/neuron-io.R

Description

If file is not specified the neuron's InputFileName field will be checked (for a dotprops object it will be the 'file' attribute). If this is missing there will be an error. If dir is specified it will be combined with basename(file). If file is specified but format is not, it will be inferred from file's extension.

Usage

1
2
write.neuron(n, file = NULL, dir = NULL, format = NULL, ext = NULL,
  Force = FALSE, MakeDir = TRUE, ...)

Arguments

n

A neuron

file

Path to output file

dir

Path to directory (this will replace dirname(file) if specified)

format

Unique abbreviation of one of the registered file formats for neurons including 'swc', 'hxlineset', 'hxskel'

ext

Will replace the default extension for the filetype and should include the period eg ext='.amiramesh' or ext='_reg.swc'. The special value of ext=NA will prevent the extension from being changed or added e.g. if the desired file name does not have an extension.

Force

Whether to overwrite an existing file

MakeDir

Whether to create directory implied by file argument.

...

Additional arguments passed to selected writer function

Details

Note that if file does not have an extension then the default extension for the specified format will be appended. This behaviour can be suppressed by setting ext=NA.

If you find that some software rejects your SWC files, try setting normalise.ids=TRUE (see examples). This will ensure that the vertex ids are sequentially ascending integers (1:N). The default value of normalise.ids=NA will normalise PointNo vertex ids only when a vertex is connected (by the Parent field) to a vertex that had not yet been defined. Many readers make the assumption that this is true. When normalise.ids=F the vertex ids will not be touched.

Value

return value

See Also

write.neurons, read.neuron, fileformats, saveRDS

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# show the currently registered file formats that we can write
fileformats(class='neuron', write=TRUE)
## Not run: 
# write out "myneuron.swc" in SWC format
write.neuron(Cell07PNs[[1]], file='myneuron.swc')
# write out "myneuron.swc" in SWC format, normalising the integer ids that
# label every node (this is required by some SWC readers e.g. Fiji)
write.neuron(Cell07PNs[[1]], file='myneuron.swc', normalise.ids=TRUE)

# write out "myneuron.amiramesh" in Amira hxlineset format
write.neuron(Cell07PNs[[1]], format = 'hxlineset', file='myneuron.amiramesh')

# write out "myneuron.am" in Amira hxlineset format
write.neuron(Cell07PNs[[1]], format = 'hxlineset', file='myneuron')

## End(Not run)

jefferis/nat documentation built on Oct. 25, 2018, 6:29 p.m.