write.neuron | R Documentation |
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.
write.neuron(
n,
file = NULL,
dir = NULL,
format = NULL,
ext = NULL,
Force = FALSE,
MakeDir = TRUE,
metadata = NULL,
...
)
n |
A neuron |
file |
Path to output file |
dir |
Path to directory (this will replace |
format |
Unique abbreviation of one of the registered file formats for
neurons including 'swc', 'hxlineset', 'hxskel' (skeletons) and 'ply', 'obj'
(neuron meshes). If no format can be extracted from the filename or the
|
ext |
Will replace the default extension for the filetype and should
include the period e.g. |
Force |
Whether to overwrite an existing file |
MakeDir |
Whether to create directory implied by |
metadata |
Whether to encode some metadata in the header file (currently
only supported for SWC format). Either a data.frame or |
... |
Additional arguments passed to selected writer function |
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=FALSE
the vertex ids will not be touched.
return value
write.neurons
, read.neuron
,
fileformats
, saveRDS
# show the currently registered file formats that we can write
fileformats(class='neuron', write=TRUE)
## Not run:
# write neuron to "myneuron.swc" in SWC format
write.neuron(Cell07PNs[[1]], file='myneuron.swc')
# write 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.swc" in SWC format withour the final extension
write.neuron(Cell07PNs[[1]], file='myneuron.swc')
# 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')
# write a mesh in Stanford ply
write.neuron(MBL.surf, file = 'MBL.surf.ply')
# ... or Wavefront obj format
write.neuron(MBL.surf, file = 'MBL.surf.obj')
# specify the format directly if not evident from file suffix
# not recommended though as will probably just cause trouble when reading
write.neuron(MBL.surf, file = 'MBL.surf', format='obj')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.