Package gifti. February 1, 2018

Similar documents
Package fastdummies. January 8, 2018

Package kirby21.base

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package canvasxpress

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package spark. July 21, 2017

Package gcite. R topics documented: February 2, Type Package Title Google Citation Parser Version Date Author John Muschelli

Package stapler. November 27, 2017

Package ECctmc. May 1, 2018

Package WordR. September 7, 2017

Package validara. October 19, 2017

Package knitrprogressbar

Package clipr. June 23, 2018

Package kdtools. April 26, 2018

Package condusco. November 8, 2017

Package robotstxt. November 12, 2017

Package sankey. R topics documented: October 22, 2017

Package crossword.r. January 19, 2018

Package barcoder. October 26, 2018

Package data.world. April 5, 2018

Package SEMrushR. November 3, 2018

Package WhiteStripe. April 19, 2018

Package IgorR. May 21, 2017

Package datasets.load

Package cregulome. September 13, 2018

Package rsppfp. November 20, 2018

Package xroi. February 13, 2019

Package docxtools. July 6, 2018

Package brainr. R topics documented: October 12, Type Package

Package calpassapi. August 25, 2018

Package semver. January 6, 2017

Package nmslibr. April 14, 2018

Package rprojroot. January 3, Title Finding Files in Project Subdirectories Version 1.3-2

Package algorithmia. September 13, 2016

Package goodpractice

Package projector. February 27, 2018

Package postgistools

Package rcmdcheck. R topics documented: November 10, 2018

Package githubinstall

Package jdx. R topics documented: January 9, Type Package Title 'Java' Data Exchange for 'R' and 'rjava'

Package phrasemachine

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package ezknitr. September 16, 2016

Package gtrendsr. October 19, 2017

Package qualmap. R topics documented: September 12, Type Package

Package EvolutionaryGames

Package rnn. R topics documented: June 21, Title Recurrent Neural Network Version 0.8.1

Package io. January 15, 2018

Package messaging. May 27, 2018

Package bisect. April 16, 2018

Package zip. R topics documented: March 11, Title Cross-Platform 'zip' Compression Version 2.0.1

Package oasis. February 21, 2018

Package sigqc. June 13, 2018

Package readobj. November 2, 2017

Package nngeo. September 29, 2018

Package pairsd3. R topics documented: August 29, Title D3 Scatterplot Matrices Version 0.1.0

Package internetarchive

Package slickr. March 6, 2018

Package rgho. R topics documented: January 18, 2017

Package gtrendsr. August 4, 2018

Package fastqcr. April 11, 2017

Package smapr. October 20, 2017

Package datapasta. January 24, 2018

Package farver. November 20, 2018

Package jstree. October 24, 2017

Package tfruns. February 18, 2018

Package wikitaxa. December 21, 2017

Package effectr. January 17, 2018

Package tibble. August 22, 2017

Package essurvey. August 23, 2018

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package pkgbuild. October 16, 2018

Package meme. December 6, 2017

Package pdfsearch. July 10, 2018

Package widyr. August 14, 2017

Package sfdct. August 29, 2017

Package vinereg. August 10, 2018

Package meme. November 2, 2017

Package covr. October 18, 2018

Package balance. October 12, 2018

Package sessioninfo. June 21, 2017

Package redux. May 31, 2018

Package styler. December 11, Title Non-Invasive Pretty Printing of R Code Version 1.0.0

Package mdftracks. February 6, 2017

Package ssh. June 4, 2018

Package queuecomputer

Package editdata. October 7, 2017

Package modmarg. R topics documented:

Package modules. July 22, 2017

Package optimus. March 24, 2017

Package lumberjack. R topics documented: July 20, 2018

Package liftr. R topics documented: May 14, Type Package

Package wdman. January 23, 2017

Package tiler. June 9, 2018

Package climber. R topics documented:

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package facerec. May 14, 2018

Package fastrtext. December 10, 2017

Package keyholder. May 19, 2018

Package loggit. April 9, 2018

Transcription:

Type Package Package gifti February 1, 2018 Title Reads in 'Neuroimaging' 'GIFTI' Files with Geometry Information Version 0.7.5 Author John Muschelli Maintainer John Muschelli <muschellij2@gmail.com> Functions to read in the geometry format under the 'Neuroimaging' 'Informatics' Technology Initiative ('NIfTI'), called 'GIFTI' <https://www.nitrc.org/projects/gifti/>. These files contain surfaces of brain imaging data. License GPL-2 Imports xml2 (>= 1.1.1), base64enc, R.utils, tools Suggests rgl, grdevices, testthat, knitr, rmarkdown, covr BugReports https://github.com/muschellij2/gifti/issues Encoding UTF-8 LazyData true RoxygenNote 6.0.1.9000 VignetteBuilder knitr NeedsCompilation no Repository CRAN Date/Publication 2018-02-01 22:21:05 UTC R topics documented: convert_binary_datatype.................................. 2 convert_endian....................................... 2 convert_intent........................................ 3 create_data_matrix..................................... 3 data_array_attributes.................................... 4 data_decoder........................................ 4 data_encoder........................................ 5 1

2 convert_endian decompress_gii....................................... 6 download_gifti_data.................................... 6 gifti_list........................................... 7 gifti_map_value....................................... 8 have_gifti_test_data..................................... 8 is.gifti............................................ 9 readgii............................................ 9 surf_triangles........................................ 10 Index 11 convert_binary_datatype Convert Binary Data Type Converts a data type to the size and what for readbin, necessary for Base64Binary and GZipBase64Binary formats convert_binary_datatype(datatype = c("nifti_type_uint8", "NIFTI_TYPE_INT32", "NIFTI_TYPE_UINT32", "NIFTI_TYPE_FLOAT32")) datatype data type from GIFTI image List of length 2: with elements of size and what convert_endian Convert Endian from GIFTI Converts Endian format from GIFTI convert_endian(endian) endian character passed from GIFTI XML

convert_intent 3 Character string convert_intent Convert Intent Converts the intent field from a GIFTI image to a more standard naming convert_intent(intent) intent (character) string of intent type A character string create_data_matrix Create Data Matrix with ordering respected Create Data Matrix with ordering respected create_data_matrix(data, dims, ordering = c("rowmajororder", "ColumnMajorOrder")) data dims ordering Data output from data_decoder Dimensions of output Ordering of the data Matrix of s

4 data_decoder data_array_attributes Data Array Attributes Parses a list of XML data to get the attributes data_array_attributes(darray) darray List of xml_nodes from GIFTI data array data.frame of attributes data_decoder Array Data Decoder Decodes values from a GIFTI image data_decoder(values, encoding = c("ascii", "Base64Binary", "GZipBase64Binary", "ExternalFileBinary"), datatype = NULL, endian = c("little", "big", "LittleEndian", "BigEndian"), ext_filename = NULL, n = NULL) values encoding datatype endian ext_filename n text from XML of GIFTI image encoding of GIFTI values Passed to convert_binary_datatype Endian to pass in readbin if encoding = "ExternalFileBinary", then this is the external filename number of values to read. Relevant if encoding = "ExternalFileBinary" Vector of values

data_encoder 5 gii_files = download_gifti_data(outdir = NULL) L = gifti_list(gii_files[1]) orig = L$DataArray$Data[[1]] encoding = attributes(l$dataarray)$encoding datatype = attributes(l$dataarray)$datatype endian = attributes(l$dataarray)$endian vals = data_decoder(orig, encoding = encoding, enc = data_encoder(vals, encoding = encoding, enc == orig data_encoder Array Data Encoder Encodes values for a GIFTI image data_encoder(values, encoding = c("ascii", "Base64Binary", "GZipBase64Binary"), datatype = NULL, endian = c("little", "big", "LittleEndian", "BigEndian")) values encoding datatype endian values to be encoded encoding of GIFTI values Passed to convert_binary_datatype Endian to pass in readbin Single character vector gii_files = download_gifti_data(outdir = NULL) L = gifti_list(gii_files[1]) orig = L$DataArray$Data[[1]] encoding = attributes(l$dataarray)$encoding datatype = attributes(l$dataarray)$datatype endian = attributes(l$dataarray)$endian

6 download_gifti_data vals = data_decoder(orig, encoding = encoding, enc = data_encoder(vals, encoding = encoding, enc == orig decompress_gii Decompress Gzipped GIFTI (with extension.gz) If a GIFTI file is compressed, as in.gii.gz, this will decompress the file. This has nothing to do with the encoding WITHIN the file decompress_gii(file) file file name of GIFTI file Filename of decompressed GIFTI gii_files = download_gifti_data(outdir = NULL) outfile = decompress_gii(gii_files[1]) print(outfile) download_gifti_data Download GIFTI Test Data Downloads GIFTI test data from https://www.nitrc.org/frs/download.php/411/bv_gifti_ 1.3.tar.gz download_gifti_data(outdir = system.file(package = "gifti"), overwrite = FALSE,...)

gifti_list 7 outdir Output directory for test file directory overwrite Should files be overwritten if already exist?... additional arguments to download.file Vector of file names gifti_list Convert GIFTI to List Reads in a GIFTI file and coerces it to a list gifti_list(file) file file name of GIFTI file List of elements gii_files = download_gifti_data(outdir = NULL) L = gifti_list(gii_files[1]) orig = L$DataArray$Data[[1]] encoding = attributes(l$dataarray)$encoding datatype = attributes(l$dataarray)$datatype endian = attributes(l$dataarray)$endian vals = data_decoder(orig, encoding = encoding, enc = data_encoder(vals, encoding = encoding, enc == orig

8 have_gifti_test_data gifti_map_value Map s to Triangles from GIFTI Takes values and maps them to the correct triangles in space. gifti_map_value(pointset, triangle, values, indices = seq(nrow(pointset)), add_one = TRUE) pointset triangle values indices add_one pointset from GIFTI triangles from GIFTI s to map to the triangles. Same length as indices indices to place the values, must be in the range of 1 and the number of rows of pointset Should 1 be added to the indices for the triangle? A list of coordinates (in triangles) and the corresponding value mapped to those triangles have_gifti_test_data Check Presence of GIFTI Test Data Checks if GIFTI test data is downloaded have_gifti_test_data(outdir = system.file(package = "gifti")) outdir Output directory for test file directory Logical indicator have_gifti_test_data(outdir = NULL)

is.gifti 9 is.gifti Test if GIFTI Simple wrapper to determine if class is GIFTI is.gifti(x) is_gifti(x) x object to test Logical if x is GIFTI readgii Read GIFTI File Reads a GIFTI File and parses the output readgii(file) readgifti(file) read_gifti(file) file Name of file to read List of values

10 surf_triangles gii_files = download_gifti_data(outdir = NULL) gii_list = lapply(gii_files, readgii) surf_files = grep("white[.]surf[.]gii", gii_files, value = TRUE) surfs = lapply(surf_files, surf_triangles) col_file = grep("white[.]shape[.]gii", gii_files, value = TRUE) cdata = readgii(col_file) cdata = cdata$data$shape mypal = grdevices::colorramppalette(colors = c("blue", "black", "red")) n = 4 breaks = quantile(cdata) ints = cut(cdata, include.lowest = TRUE, breaks = breaks) ints = as.integer(ints) stopifnot(!any(is.na(ints))) cols = mypal(n)[ints] cols = cols[surfs[[1]]$triangle] ## Not run: if (requirenamespace("rgl", quietly = TRUE)) { rgl::rgl.open() rgl::rgl.triangles(surfs[[1]]$pointset, color = cols) rgl::play3d(rgl::spin3d(), duration = 5) ## End(Not run) surf_triangles Make Triangles from GIfTI Image Creates Triangles for plotting in RGL from a GIfTI image surf_triangles(file) file File name of GIfTI image, usually surf.gii List of values corresponding to the data element from readgii

Index convert_binary_datatype, 2, 4, 5 convert_endian, 2 convert_intent, 3 create_data_matrix, 3 data_array_attributes, 4 data_decoder, 3, 4 data_encoder, 5 decompress_gii, 6 download.file, 7 download_gifti_data, 6 gifti_list, 7 gifti_map_value, 8 have_gifti_test_data, 8 is.gifti, 9 is_gifti (is.gifti), 9 read_gifti (readgii), 9 readbin, 2, 4, 5 readgifti (readgii), 9 readgii, 9, 10 surf_triangles, 10 11