move_to_submask
andmove_from_submask
- add support for writing older xiftis w/o "Other" level in sub labels
- fix subcortex bugs
- Make default of
read_cifti
all brain structures, instead of left and right cortex only - add "Other" to subcortex levels
Minor fixes and improvements.
ciftiTools
now has a couple functions which make working with parcellations easier. (A parcellation is a single-column dlabel CIFTI or "xifti"
object. Each label level, or "Key", represents a "parcel." Each location belongs to exactly one parcel. Parcels are usually contiguous regions--but not necessarily. ciftiTools
includes a few of the most commonly-used parcellations. These can be loaded with load_parc
. Any other parcellation CIFTI file can be read in with read_cifti
.)
apply_parc
: Apply a parcellation"xifti"
to a data"xifti"
. Can be used to compute the mean of each column, e.g. for FC calculation, but also supports applying any other function parcel-wise.parc_vals_to_xifti
: Create a"xifti"
from a parcellation and a numeric matrix of values corresponding to each parcel.
Other new functions:
remap_cifti
: an extension of resampling. Beware, we might revamp this function in the future.surf_area
: computes the surface area attributable to each vertex or face of a"surf"
object.
Changes to existing functions:
convert_xifti
,convert_to_dlabel
: arguments related to levels & labels have been renamed to matchfactor
more closely.separate_cifti
andwrite_xifti2
: now require users to provide either thewrite_dir
argument, or file names for each desired output file. This gives users more flexibility to control which files are written.view_xifti
qualitative color legend: add black outline.view_xifti
,view_volume
: print out indices of the selected subcortical slices.unmask_subcortex
: now expectsxifti
input. If necessary, use the internal functionciftiTools:::unvec_vol
to unmask a numeric matrix directly.
Bug fixes:
view_xifti
: fix bug where legend image was still written iflegend_fname=NULL
.
13.1 also includes misc. documentation and warning improvements.
New features
- Proper writing out of
dlabel
CIFTI data. Fixed problems if multiple columns or with subcortical data. - Add
even_vert_samp
. - Add
apply_parc
. - Add
set_names_xifti
. - Add
NA_color
argument toview_xifti_surface
. - Add
shadows
argument toview_xifti_surface
. mask_surf
takes in a"surf"
object now.- Misc. documentation and warning improvements.
Changes to default behaviors
- Add
crop
toview_xifti_volume
; the default isTRUE
. Previously the subcortical images were cropped to the anatomical image; now the default is to crop them to the data. - Change default of
orientation_labels
inview_xifti_volume
toTRUE
. - Allow
NA
andNaN
values in"xifti"
objects with label data. Leave these values alone rather than making them into factor levels. - Add warning if surface data are being upsampled
- Delete helper file surfaces written by
smooth_cifti
rather than returning their file paths.
New features
- Add adaptive resampling for surface data. The default remains barycentric.
- Add surface manipulation functions from
BayesfMRI
. - Allow
xii + mat
(and other operations) - Add
scientific
argument toview_xifti
. By default, scientific notation is determined automatically (as before). - Misc. patches
Documentation
- Add lit vs unlit comparison to README
- Improved citations
- Fix error during resampling when only one hemisphere is present
- Better file I/O on mounted Google Drive
- Add new viridis color palettes
- Coerce new data input to newdata_xifti to numeric
- Add file extension to file name in write_xifti automatically, if not provided
New features
- Add convention and orientation_labels to view_xifti_volume (default: neurological, instead of radiological as it's been previously)
- Add together_ncol to view_xifti_* to control compositing layout
- Add fname argument to view_comp to save the result to a PNG file
- Allow "xifti" objects to have different resolutions in the left and right cortex
- Add citation to welcome message
Behind-the-scenes improvements
- Better file path management for system commands
- Better use of S3 group methods for Math, Ops, Summary functions
- Replace coveralls with codecov
- Misc. patches
- Add more support for reading in v1 CIFTI files
- Better handling of file paths
- Better handling of optional
"xifti"
metadata remove_xifti
can delete individual subcortical structures now- Add
scale_xifti
which works likescale
- Add
view_comp
, and the argumenttogether
toview_xifti_surface
andview_xifti_volume
- Fixes to
view_xifti_surface
andview_xifti_volume
- Add limited support for v1 CIFTI
- Fix some file paths of written files
- Lower default surface smoothing from sigma = 5 to sigma = 3
- Add
trans_units
to subcortex metadata - Rename
write_cifti_components
aswrite_xifti2
and export - Add (in)equalities between
"xifti"
objects - Add workbench download URL to start message.
- Add internal functions
vox_locations
andedit_mask_surf
- Revamped subcortical visualization with
view_xifti_volume
! Added tests for it. plot
will now show both the cortex and subcortex, if both are present. The plots will share the color mode, color palette, and zlim.- Revamped
summary
/print
for"xifti"
objects - Faster border computation in
read_xifti_surface
- Oops! The MNI image was removed in one of the recent versions. Added it back.
- Minor fixes
- Fix bug in
read_cifti_convert
where surfaces are not included - Switch from
ciftiTools.files
back to a function,ciftiTools.files()
, because the latter doesn't actually work - Better handling of bad argument inputs and of the case where
rgl.useNULL()
inview_xifti_surface
- Rename
unmask_vol
tounmask_subcortex
- New interface for reading in data included in the package
ciftiTools.files
replacesdemo_files()
. This variable is created in the user's environment uponlibrary(ciftiTools)
with lazy loadingciftiTools.files
will only contain the inflated surface. To import the other two surfaces, useload_surf()
. Removed the"surf"
option fromciftiTools.setOption
.
- Better handling of surfaces
add_surf
will automatically resample the surfaces if neededread_surf
has the argumentresamp_res
to enable resampling upon reading in the surface, similar toread_xifti
newdata_xifti
will accept a length-one vector, to create a constant-valued"xifti"
ciftiTools.data
contains the surfaces and parcellations building blocks, and the HCP 32k medial wall
- New surfaces! Check out
ciftiTools.setOption("surf", ...)
The default surface is still very inflated, but different. - Parcellations are now included in the package! Check out
load_parc
. - Add
apply_xifti
- Add
move_to_mwall
andmove_from_mwall
- Add
idx
argument toread_xifti
and related functions - Add
...
argument totransform_xifti
- Add
write_surf
, an alias forwrite_surf_gifti
- Export
fix_xifti
, which ensuresxifti$data
entries are matrices - Fix legend plot file placement in
view_xifti_surface
- Updated package documentation
make_surf
is now an alias forread_surf
, instead of the other way around
convert_xifti
accepts CIFTI files too- Add
as.matrix
S3 method - Fix interactive papayar view for
view_xifti_volume
None
- Rename
concat_xifti
asmerge_xifti
- Rename
gifti_to_surf
asread_surf
- Add
combine_xifti
- Add
convert_xifti
and make the individual conversion functions (e.g.convert_to_dlabel
) internal - Add
smooth_gifti
for metric GIFTI smoothing - Add S3 method
dim
forxifti
objects - Add
legend_alllevels
arg toview_xifti_surface
- More control over legend file name in
view_xifti_surface
- Add intent to summary output
write_xifti
will infer the intent/extension if not included in output file name
None
None
- Add
run_ciftiTools_tests.R
to.Rbuildignore
- Search for "wb_path" during
ciftiTools.setOption
call, and never afterward - Ignore Workbench warnings, for the most part
- Remove arguments concerning intermediate files in
resample_cifti
andread_cifti
- Too many changes to document for
view_xifti_surface
! transform_xifti
improvements- Export
remove_xifti
- Add
rotate_surf
,select_xifti
andconcat_xifti
- Replace
surface_sigma
withsurf_FWHM
and likewise for volume - Better handling of plotting surface or volume in
view_xifti
- Warn user (instead of raising an error) when the data has more medial wall vertices than non-medial wall vertices.
- New handling of color mode, default colors and color limits.
- Save color legends too, if saving surface plots.
- Label for widget slider.
- Move
fields
andrgl
from Suggests to Imports. - Remove
wb_path
argument. (UseciftiTools.setOption("wb_path", "path/to/workbench")
) transform_xifti
to apply unary functions- Add mathematical operations:
exp(cii) / 5 + cii2
newdata_xifti
to substitute data
smooth_cifti
- Add smoothing a
xifti
directly cifti_target_fname
is optional tosmooth_cifti
; will be auto-generated ifNULL
- Use the surfaces included with the
ciftiTools
package if not provided tosmooth_cifti
when corresponding cortex data exists
- Add smoothing a
view_xifti_surface
- Rename arguments regarding interactivity
- Add option to draw borders for qualitative coloring
- Add color legend with names of labels for qualitative coloring
- Rename
surface
class tosurf
as.xifti
- Use HCP 32k mwall when not provided, by default (add option to control)
- Add option to add column names
- Retain more CIFTI metadata during resampling
- Reduce package size to < 5 for CRAN by resampling demo files.
- Add
run_ciftiTools_tests.R
(and add to .Rbuildignore) - Do not try linking to RColorBrewer::brewer.pal.info because it is an object, not a function.
- Correct
ciftiTools.listOptions
andciftiTools_msg
- Make
gifti_to_surf
an alias tomake_surf
- Add widget with slider for
view_xifti_surface
when more than oneidx
is requested!- Replace
mode
argument withinteractive
argument - Automatically use widget or video frames if more than one
idx
- Replace
- Resilience to missing "MetaData" entry in CIFTI$Matrix
view_xifti_surface
- Option to draw vertices and edges
- Automatically use (and resample to match data resolution) included surfaces, in most cases where surfaces were not provided
view_xifti_volume
- Fix error when data are integers
- Check that image dimensions and transformation matrix match with MNI template before plotting
- Use 9 slices instead of 12 by default (when not using
papayar
)
- New argument
mwall_values
to relevant functions.- The values will be used to infer the medial wall if the medial wall is not explicitly specified
- Default:
NA
andNaN
- This argument can be set to
NULL
to not infer the medial wall from the data
- Better reading & writing of NIFTI and GIFTI files
- Export and import 4x4 transformation matrix with CIFTI and NIFTI files
- Use the
TransformationMatrixIJKtoXYZ
in CIFTI files - Use the
sform
codes in NIFTI files
- Use the
- Export and import label table and column names with CIFTI and GIFTI files (for
dlabel
anddscalar
) - Write NIFTI with
RNifti
instead oforo.nifti
- Export and import 4x4 transformation matrix with CIFTI and NIFTI files
- Corrected separating, writing and resampling
*.dlabel.nii
files - Make
cifti_fname
inread_cifti
optional (can read in just the surfaces) - Warning if brainstructure is requested but not available (instead of error)
- Convert smoothed
dlabel
todscalar
(and add warning, because it's probably something you don't want to do) - Documentation improvements
- Improved handling of bad arguments to
make_subcort
- Split
info_cifti_raw
intoheader_cifti
andxml_cifti
- Add the internal functions
remove_xifti
,expect_equal_xifti
andfix_gifti_mwall
view_surf
is now a wrapper toview_xifti_surface
instead of being its own function- Move color functions to
utils_color
. - Make
ROY_BIG_BL
have an extra value to fix legend range. - Handle constant-valued data in
view_xifti_surface
- Export color functions
- Add "hemisphere" metadata to \code{"surf"} objects, and check that it matches if it exists. For example,
as.xifti(surfL=surfR_gii)
will cause an error - Move
rgl
andfields
to Suggests - Add a few new tests based on these changes
- Spheres are no longer required to input for resampling
- In-register spheres are generated automatically based on the cortical resolution
- Full label table list for
dlabel.nii
files - Add
smooth_cifti
- Add
resample_cifti_from_template
- Add helpful error message if
plot(xii)
is called without any surface or subcortical data view_xifti_surface
improvements:- Use column index or name as the default title
- Improved qualitative color mode
- Use qualitative color mode and label table colors if the CIFTI is a
dlabel.nii
file (intent 3007)
view_xifti_volume
improvements:- Fix
num.slices
argument - Add
...
for additional arguments
- Fix
- Add
view_surface
for"surface"
objects - Add
summary
andplot
methods for"surface"
objects - Warning if GIFTI version is too old (need the one on github for
writegii
) - Tweaks to
view_xifti_surface
defaults - Add
view_xifti_volume
without structural image - If a function writes a file(s) as its main side effect, return a named character vector of the written file paths.
- Previously some functions returned
TRUE
while others returned alist
ordata.frame
of written file paths
- Previously some functions returned
- Out-of-mask values (medial wall for cortex and non-subcortical voxels for subcortex)
are no longer inferred from the data values when making a
"xifti"
from GIFTI and NIFTI files. Previously, if a mask was not provided then constant0
,NA
, orNaN
values were deemed out-of-mask. Now,ciftiTools
uses ROI files to keep track of the out-of-mask values inread_cifti_separate
andresample_cifti
, and requires the masks to be explicitly provided inas.xifti
- Rename
make_surface
asmake_surf
- Rename
is.surface
asis.surf
- Rename
side
argument ashemisphere
argument (same choices:"left"
or"right"
) - Fixed the alias functions, e.g.
readCIfTI
andreadcii
forread_cifti
- The demo files from NITRC are now included with
ciftiTools
: https://www.nitrc.org/frs/download.php/8541/cifti-2_test_data-1.2.zip
- Add tests for most user functions
- Rename
write_xifti_components
aswrite_cifti_components
- Remove
metric_resample
andsurface_resample
(useresample_gifti
directly) - Rename
make_helper_spheres
aswrite_spheres
, and do not export it - Rename
unmask
asunmask_vol
(to distinguish fromunmask_cortex
) - Remove
data-raw
from R package build - Require
gifti > 0.7.5
- Clean up
onAttach
and.Rbuildignore
It will be located here: https://htmlpreview.github.io/?https://github.com/mandymejia/ciftiTools/blob/master/vignettes/ciftiTools_vignette.html once we push to master. Until then, replace "master" with "1.4"
- introduce
"xifti"
object: can be made from CIFTI file, GIFTI surfaces, or new data- To make a
"xifti"
from data:as.xifti(...)
- To make a
"xifti"
from a CIFTI file:read_cifti(cifti_fname)
- To make a
"xifti"
from a GIFTI surface:as.xifti(surfL=make_surf(surfL_fname))
- To make a
read_cifti_flat
now uses XML metadata directly (but still obtains XML via Connectome Workbench)- This allows for reading in more metadata such as time start/step for
.dtseries.nii
- This allows for reading in more metadata such as time start/step for
write_surf_gifti
andwrite_metric_gifti
as wrappers to the newgifti::writegii
- Currently depends on
damondpham/gifti
but this will hopefully be merged to main repo soon
- Currently depends on
write_subcort_nifti
to write out subcortical components from"xifti"
to a NIFTI filewrite_cifti
can also write the surfaces attached to the"xifti"
"xifti"
objects can contain surfaces without any data.view_xifti_surface
can view a surface without any data:plot(as.xifti(surfL=left_surf))
resample_surf
to resample a surface object
read_cifti_flat
andread_cifti_separate
- flatten subcortical data in
"cifti"
object. unflattening functions. - image view mode
write_cifti
- better handling of medial wall
- Subcortical color table added for writing CIFTIs. Taken from: https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/AnatomicalROI/FreeSurferColorLUT
Most of the functions were renamed. In general, cifti_[action]
is now [action]_cifti
. So to open and visualize a CIFTI file, one would use read_cifti()
followed by view_cifti()
. To save a resampled version of a CIFTI file, one would use resample_cifti()
.
Arguments were also renamed for consistency across functions:
- Arguments referring to file names all end in
_fname
instead of beginning withfname_
. - The cortical data,
surf_L
orcortex_left
, are nowcortexL
(likewise for right). - The surface geometry data,
gifti_left
orsurf_left
, are nowsurfL
(likewise for right). - The helper sphere for resampling,
sphere_L
, is nowsphereL
(likewise for right). sphere_orig_L
is nowsphereL_original
(likewise for right; likewise for other original files).sphere_target_L
is nowsphereL_target
(likewise for right; likewise for other target files).- The resampling resolution,
target_res
orresample
, is nowresamp_res
. - The Connectome Workbench argument
wb_cmd
is nowwb_path
. outdir
is nowwrite_dir
.
There are a few new functions:
read_cifti_flat()
reads the cortical and surface data together as a single matrix.- It is much faster than
read_cifti()
. - It works by using the Connectome Workbench command
-cifti-convert -to-gifti-ext
. flatten_cifti()
converts a"cifti"
object to this same matrix.read_cifti()
withflat==TRUE
will callread_cifti_flat()
.
- It is much faster than
make_xifti()
creates a"cifti"
object from its components.- Each component can be provided as a file name or R object.
view_cifti()
plots the CIFTI data.- It calls
view_cifti_surface()
unless no cortical data exists, in which case it will tryview_cifti_volume()
. view_cifti_surface()
was rewritten using thergl
package directly.
- It calls
And, a few new arguments:
sep_keep
andresamp_keep
indicate whether separated or resampled files should be deleted after reading in the CIFTI data (read_cifti()
) or writing the resampled CIFTI file (resample_cifti()
). Their default values areFALSE
. in which case these files are written to a temporary directory (regardless ofwrite_dir
).sep_fnames
andresamp_fnames
can be used to set the file names for the respective files made byread_cifti
andresample_cifti
.- The default separated and resampled file names have been updated; see
cifti_component_suffix
.
- The default separated and resampled file names have been updated; see
Other updates:
- Print execution times for each step in
separate_cifti()
andresample_cifti()
ifverbose==TRUE
. - Add option to set Connectome Workbench directory for the entire session with
ciftiTools.setOption('wb_path', 'path/to/workbench')
.- Either the folder or executable path can be provided.
- Handling of spaces and parentheses in file names.
- The ROI data can be separated and resampled. However, the
"cifti"
object does not support ROIs, so they are ultimately not loaded.- Please contact the developers if you are interested in this functionality.
- A workaround would be to separate/resample the ROIs, and then read them in with
make_xifti()
(haven't tested this yet).
- Add option to store a zero-value threshold,
EPS
. Set it withciftiTools.setOption("EPS", 1e-8)
. This is used byview_cifti()
andflatten_cifti()
to detect constant zero brainordinates. - Several function aliases, for example
readCIfTI()
andreadcii()
forread_cifti()
. plot()
method for"cifti"
objects.
- The
overwrite
andmake_helper_files
arguments were removed. All functions will overwrite existing files, and this cannot be changed. - A
"cifti"
object will only support one surface geometry model at a time.view_cifti()
can accept a surface GIFTI file directly.
- The default brainstructures are
left
andright
only (excludes the subcortical data).
- Replaced
oro.nifti::readNIfTI()
withRNifti::readNifti()
for faster reading of subcortical data. - Made formal classes for each CIFTI file component:
"cifti_surface"
,"cifti_subcortical"
,"cifti_cortex"
,"cifti_volume"
and"cifti_label"
. - Replaced
read_separate_cifti()
withread_cifti()
, which callsseparate_cifti()
,resample_cifti_components()
(optionally), andmake_xifti()
in that order. - Rewrote
resample_cifti()
. The new version callsseparate_cifti()
,resample_cifti_components()
, and then uses a template to create the new CIFTI file. (The first half is nearly identical toread_separate_cifti()
.) - Moved common argument/parameter descriptions to
rox_args_docs.R
. Use@inheritParams
to reference these descriptions. This should make maintaining them across the entire package easier. - Wrapper functions
separate_cifti_wrapper()
andresample_cifti_wrapper()
to avoid duplicate code acrossread_cifti()
andresample_cifti()
. These should not be used by end-users, so they are not exported. - Split utility functions into
utils.R
for general functions andutils_cifti.R
for CIFTI-specific functions.