Type: | Package |
Title: | Read and Write 'MTrackJ Data Files' |
Version: | 0.2.2 |
Description: | 'MTrackJ' is an 'ImageJ' plugin for motion tracking and analysis (see https://imagescience.org/meijering/software/mtrackj/). This package reads and writes 'MTrackJ Data Files' ('.mdf', see https://imagescience.org/meijering/software/mtrackj/format/). It supports 2D data and read/writes cluster, point, and channel information. If desired, generates track identifiers that are unique over the clusters. See the project page for more information and examples. |
License: | GPL-3 | file LICENSE |
LazyData: | TRUE |
Depends: | R (≥ 2.10) |
URL: | https://github.com/burgerga/mdftracks |
BugReports: | https://github.com/burgerga/mdftracks/issues |
RoxygenNote: | 7.2.3 |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
Suggests: | testthat, tools, tibble, spelling |
Language: | en-US |
NeedsCompilation: | no |
Packaged: | 2023-12-24 12:42:43 UTC; burge |
Author: | Gerhard Burger |
Maintainer: | Gerhard Burger <burger.ga@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2024-01-08 10:00:06 UTC |
mdftracks: Read and Write 'MTrackJ Data Files'
Description
'MTrackJ' is an 'ImageJ' plugin for motion tracking and analysis (see https://imagescience.org/meijering/software/mtrackj/). This package reads and writes 'MTrackJ Data Files' ('.mdf', see https://imagescience.org/meijering/software/mtrackj/format/). It supports 2D data and read/writes cluster, point, and channel information. If desired, generates track identifiers that are unique over the clusters. See the project page for more information and examples.
Author(s)
Maintainer: Gerhard Burger burger.ga@gmail.com (ORCID)
See Also
Example data to show mdftracks functionality
Description
Example data to show mdftracks functionality
Usage
mdftracks.example.data
Format
A data frame with 10 rows and 9 variables
- cl
track cluster
- id
track identifier (in cluster)
- p
point in track (not necessarily the same as frame number)
- x
x-coordinate of point
- y
y-coordinate of point
- z
z-coordinate of point
- t
time of point
- ch
track channel
- uid
track identifier (unique over clusters)
Source
Self-generated
Read an MTrackJ Data File (.mdf
)
Description
Reads an MTrackJ Data File (.mdf
) file in a data.frame.
Usage
read.mdf(
file,
drop.Z = F,
include.point.numbers = FALSE,
include.channel = F,
generate.unique.ids = F,
text,
fileEncoding = ""
)
Arguments
file |
MTrackJ Data File ( |
drop.Z |
drop z-coordinate (for 2D data) |
include.point.numbers |
include the point numbers in the mdf file (NB these can be different from the time/frame points) |
include.channel |
include channel information |
generate.unique.ids |
combine cluster and id columns to get unique ids |
text |
character string: if file is not supplied and this is, then data are read from the value of text via a text connection. Notice that a literal string can be used to include (small) data sets within R code. |
fileEncoding |
character string: if non-empty declares the encoding to
be used on a file (not a connection) so the character data can be re-encoded
as they are written. See |
See Also
Other mdftracks functions:
write.mdf()
Examples
read.mdf(system.file("extdata", "example.mdf", package = 'mdftracks'))
Write an MTrackJ Data File (.mdf
)
Description
Writes a data.frame with tracking information as an MTrackJ Data File (.mdf
)
file. Allows flexible column specification, and to avoid errors the column
mapping used for writing is reported back to the user. Writing tracking data in
'id time x y z' format, for example, from the celltrackR package, doesn't
require additional arguments.
Usage
write.mdf(
x,
file = "",
cluster.column = NA,
id.column = 1,
time.column = 2,
scale.time = 1,
pos.columns = c(3, 4, 5),
channel.column = NA,
point.column = NA,
default.channel = 1,
fileEncoding = ""
)
Arguments
x |
the data.frame with track information. |
file |
either a character string naming a file or a connection open for writing. "" indicates output to the console. |
cluster.column |
index or name of the column that contains the cluster ID. |
id.column |
index or name of the column that contains the track ID (either the id in the cluster or a unique id). |
time.column |
index or name of the column that contains elapsed time |
scale.time |
a value by which to multiply each time point. Useful for changing units, or specifying the time between positions if the time is given in frames. |
pos.columns |
vector containing indices or names of the columns that contain the spatial coordinates. If this vector has two entries, the data is assumed to be 2D and the z coordinate is set to 1.0. |
channel.column |
index or name of the column that contains channel
information. If there is no channel column |
point.column |
index or name of the column that contains point ID. If there is no point column, points will be numbered automatically (NB points are not necessarily the same as frames). |
default.channel |
channel to be used if |
fileEncoding |
character string: if non-empty declares the encoding to
be used on a file (not a connection) so the character data can be re-encoded
as they are written. See |
See Also
Other mdftracks functions:
read.mdf()
Examples
## Not run:
# Output to file
write.mdf(mdftracks.example.data, '~/example.mdf', id.column = 'uid',
time.column = 't', pos.columns = letters[24:26])
## End(Not run)
# Output to stdout with cluster column
write.mdf(mdftracks.example.data, cluster.column = 'cl',
id.column = 'id', time.column = 't', pos.columns = letters[24:26])
# Output to stdout using data in (id, t, x, y, z) format
write.mdf(mdftracks.example.data[, c('uid', 't', letters[24:26])])