Giter Club home page Giter Club logo

cifti-matlab's People

Contributors

coalsont avatar robertoostenveld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cifti-matlab's Issues

ciftisavereset not working when manipulating pconns and saving as pscalars

Hi,
In the newest version of ciftisavereset I am able to open pconns, modify them to pscalar format, and the save as a pscalar file, but there appears to be a glitch.

`cii=ciftiopen('matrix.pconn.nii',workbench);
cii =

struct with fields:

metadata: [1×4 struct]
 diminfo: {[1×1 struct]  [1×1 struct]}
   cdata: [414×414 single]`

new=cii.cdata(:,414);
cii.cdata=new;
ciftisavereset(cii,'/filepath/new.pscalar.nii',workbench)

the file won't open in workbench. Also it cannot be read with wb_command -file-information On the original version it still works.
Screen Shot 2021-12-20 at 1 01 09 PM

Help info formatting

A different type of question, what should the formatting be for help information?

First, matlab help info of built-in functions is generally summary first, then multiple function signatures (really, using different optional arguments) with explanations interspersed. The current cifti-matlab help has function signatures first (and includes the function keyword), and then the description immediately below that, then options, and examples (when present) at the bottom.

Examples:

>> help unique
 unique Set unique.
    C = unique(A) for the array A returns the same values as in A but with 
    no repetitions. C will be sorted.    
   
    C = unique(A,'rows') for the matrix A returns the unique rows of A.
    The rows of the matrix C will be in sorted order.
...
>> help cifti_read
 function outstruct = cifti_read(filename, ...)
    Read a cifti file.
    If wb_command is not on your PATH and you need to read cifti-1
    files, specify "..., 'wbcmd', '<wb_command with full path>'".
 
    >> cifti = read_cifti('91282_Greyordinates.dscalar.nii');
    >> cifti.cdata = outdata;
    >> cifti.diminfo{2} = cifti_diminfo_make_scalars(size(outdata, 2));
    >> write_cifti(cifti, 'ciftiout.dscalar.nii');

How closely do people want this to match matlab builtin help formatting and order?

optional inputs

Some of the functions (generally lower-level) still have optional arguments that don't use varargin, so if we don't change them to use varargin, how should the help info look? Some ideas:

  1. like matlab multi-signature help info on zeros:
    %function outmap = cifti_diminfo_make_scalars(nummaps)
    %function outmap = cifti_diminfo_make_scalars(nummaps, namelist)
    %function outmap = cifti_diminfo_make_scalars(nummaps, namelist, metadatalist)
  1. square brackets, like many command line utilities:
    %function outmap = cifti_diminfo_make_scalars(nummaps[, namelist, metadatalist])
  1. no notation, and expect people to read the help down to where it says what is optional (this is what is currently implemented):
    %function outmap = cifti_diminfo_make_scalars(nummaps, namelist, metadatalist)
...
    %   Only the nummaps argument is required.

optional outputs

Some functions also have multiple outputs, and in matlab all outputs are automatically optional (a function can be coded to check the number of output arguments and manually throw an error, or even change its behavior, but there is no reason to do that here). Can we expect users to be aware of this, or do we need some notation for that also? Example:

    %function [outdata, outroi] = cifti_struct_dense_extract_surface_data(cifti, structure, dimension)

The help info for unique starts with the 4 combinations of single vs multi output, and single versus multiple arguments, but discontinues that method as soon as it reaches more advanced options. So, some options:

  1. like matlab help info on unique, start with a few combinations, then any further optional arguments use only the all-outputs notation:
    %function outdata = cifti_struct_dense_extract_surface_data(cifti, structure)
    %function [outdata, outroi] = cifti_struct_dense_extract_surface_data(cifti, structure)
    %function outdata = cifti_struct_dense_extract_surface_data(cifti, structure, dimension)
    %function [outdata, outroi] = cifti_struct_dense_extract_surface_data(cifti, structure, dimension)
    %function [outdata, outroi] = cifti_struct_dense_extract_surface_data(cifti, structure, dimension, somefutureopt)
  1. separate input and output sections:
    %function outdata = cifti_struct_dense_extract_surface_data(...)
    %function [outdata, outroi] = cifti_struct_dense_extract_surface_data(...)
    %function ... = cifti_struct_dense_extract_surface_data(cifti, structure[, dimension, somefutureopt])
  1. just the full outputs notation, and expect users to know how to ignore outputs they don't need (this is what is currently implemented)

Error in read_gifti_file_standalone

Dear cifti-matlab experts,
When I use the read_gifti_file_standalone to read my xxx.shape.gii file, which is a metric file in HCP workbench version. There some error. the command is matrix=read_gifti_file_standalone('/xxx/xxx.shape.gii','data')
error:
Reference to non-existent field 'data'.
Error in read_gifti_file_standalone (line 48)
this.data{end+1} = gifti_DataArray(t,uid(i),filename);
I don't know what's wrong. When I execute structure=gifti('/xxx/xxx.shape.gii')
the return is:
val =
cdata: [32492x1 single]

Anyone can help me?

Best
Guoyuan

Naming conventions/design of new library

Given the rewrite of the library, this issue is to gather input on naming conventions, in the hopes of improving things before we declare the new library ready for users.

I see a likely source of confusion in cifti_dense_get_surface_mapping(), in that the string "surface mapping" may make users think it refers to "volume to surface mapping", which is a very different thing (resampling, and not merely a file format detail). Anyone have some ideas? A synonym like "correspondence" could work, but that is longer and more clunky, and I am drawing a blank on other good synonyms. Another possibility is to shorten them to "map" instead of "mapping" (cifti_dense_get_vol_all_map(), etc).

It would probably be good to standardize to using only one of vol or volume in the helper names, but I'm not sure whether clarity or brevity should be favored here.

If you have any other comments on the new library other than bugs, you can post them here, too (bugs deserve new issues).

provide a pointer to the existing test scripts

LabelTable not returned

This library does not return the color tables for Parcellation maps for reference datasets. The cifti file reports CIFTI_INDEX_TYPE_LABELS and the Matlab code dutifully reads the LabelTable Colors. However, the Matlab code never returns the color lookup table values to the user. Specifically, consider the XML

<Label Key="360" Red="0.478431" Green="0.145098" Blue="0.286275" Alpha="1">L_p24_ROI</Label>

which defines vertices of index 360 to have specific RGBA values and the name L_p24_ROI. While the Matlab code parses this XML table, it is not returned as part of the struct:

cii = ft_read_cifti('Q1-Q6_RelatedParcellation210.CorticalAreas_dil_Final_Final_Areas_Group_Colors.32k_fs_LR.dlabel.nii')

  struct with fields:

                 dimord: 'pos'
               indexmax: [64984×1 double]
                    hdr: [1×1 struct]
                   unit: 'mm'
         brainstructure: [64984×1 double]
    brainstructurelabel: {'CORTEX_LEFT'  'CORTEX_RIGHT'}
                    pos: [64984×3 double]


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.