Coder Social home page Coder Social logo

cifti's People

Contributors

mmyers2022 avatar muschellij2 avatar mychan24 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

cifti's Issues

Error using read_cifti with pscalar file

I am having trouble reading a pscalar.nii file using read_cifti.

I get an error like the following:

Error in attributes(x) = a : attributes must be a list or NULL

I have traced the issue to the parce_parcel function, specifically to a mapply call:

verts = mapply(function(x, a) {
                attributes(x) = a
                return(x)
}, verts, vert_attr, SIMPLIFY = FALSE)

When that function is called, verts is a list with one element. That element is an array with 783 elements in this case (it represents the vertices associated with the first parcel, I assume). vert_attr is also a list with one element, a string representing the parcel label (in this case "R_V1_ROI").

> vert_attr
[[1]]
[1] "R_V1_ROI"

Even if I were to try to manually set the attribute like this:

attributes(verts[[1]]) <- vert_attr

it produces this error: Error in attributes(verts[[1]]) <- vert_attr : attributes must be named

because an earlier line in the get_verts function stripped the vert_attr of its name. That line is:

vert_attr = as.list(vert_attr[[1]])

I think this is because the result of vert_attr = xml_attrs(node) is:

> vert_attr
      Name 
"R_V1_ROI"  

If I just do as.list then it becomes:

> as.list(vert_attr)
$Name
[1] "R_V1_ROI"

which works fine in this call:

attributes(verts[[1]]) <- vert_attr

Sorry if this issue is convoluted!

Distinguishing dimensions for asymmetric matrices

Really love this package, thanks for creating it. Does it currently allowing reading and distinguishing the parcel labels of different dimensions for asymmetric pconn.nii files (permitted in the CIFTI specification)? This would correspond to the ALONG_ROW and ALONG_COLUMN map type fields from wb_command -file-information.

read_cifti errors when used in library code (without loading package)

I am using the latest cifti from CRAN, currently version 0.4.5. When using the read_cifti function from library code (i.e., without loading the cifti package), it throws the following error:

# important: start a fresh R session and do NOT load cifty before doing this:
cifti::read_cifti('~/data/cifti/Conte69.MyelinAndCorrThickness.32k_fs_LR.dscalar.nii')
Error in get_volume(fname = "~/data/cifti/Conte69.MyelinAndCorrThickness.32k_fs_LR.dscalar.nii") : 
could not find function "get_volume"

The function works fine once cifty is loaded:

library('cifti')
cdt = cifti::read_cifti('~/data/cifti/Conte69.MyelinAndCorrThickness.32k_fs_LR.dscalar.nii')

Note: The .dscalar.nii file used in the example above is the one from the official CIFTI 2 demo files at nitrc, the one you also download in cifti::download_cifti_data(). The file does not matter for the error though.

I checked the source code and the error comes from line 28 in get_cifti_type.R, which builds the function name 'get_volume' (line 22, among others) and runs it. When the cifti package is not loaded, that function is not found for some reason.

I tried to modify line 22 from paste0("get_", run_type) to paste0("cifti::get_", run_type), but this does not work at all (throws errors) for reasons which I don't understand.

If you have any idea on how to use the read_cifti function from the code of another package, that would be great. And btw, thanks for making and publishing the cifti package.

The error remains unchanged when using the latest development version from GitHub.

This is cool!

Sorry for the issue, but I just wanted to say this is great! Any plans to upload to CRAN?

trying to work with HCP data, binary connection error

Hello, trying to work with Human Connectome Project data through R.
The following:

left_gii = "~/Downloads/HCP_WB_Tutorial_1.0/Q1-Q6_R440.L.inflated.32k_fs_LR.surf.gii"
right_gii = "~/Downloads/HCP_WB_Tutorial_1.0/Q1-Q6_R440.R.inflated.32k_fs_LR.surf.gii"
file = "~/Downloads/HCP_S1200_GroupAvg_v1/S1200.curvature_MSMAll.32k_fs_LR.dscalar.nii"

left_gii = system.file("extdata", left_gii, package = "cifti")
right_gii = system.file("extdata", right_gii, package = "cifti")
file = system.file("extdata", file, package = "cifti")

#####################################
# Getting the Left coordinates/value mapping for cifti
#####################################
left = cifti_coords_gifti(
  file,
  gii_file = left_gii,
  structure = "CIFTI_STRUCTURE_CORTEX_LEFT")
# gifti surface
left_surf = surf_triangles(left_gii)

Gives me the error:
Error in readBin(fid, integer(), size = 4, endian = endian) : can only read from a binary connection

I am not sure what the issue is, I am not familiar with readBin(). I have tested the gifti and cifti files in wb_view (HCP's visualization tool) and they open fine.

Thanks for developing this!
G

PS: details on my installation and os
platform x86_64-apple-darwin15.6.0
arch x86_64
os darwin15.6.0
system x86_64, darwin15.6.0
version.string R version 3.4.2 (2017-09-28)

Question about write_cifti function

I noticed there is a write_cifti function that was written but not included with the package. If I may ask, are there known issues that make it unviable?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.