Skip to content

COMMIT2: mismatch between params_IC and input tractogram #154

@SimonaLeserri

Description

@SimonaLeserri

Description

I am following the COMMIT2 tutorial and trying to apply it to the tractoInferno dataset, for which I have obtain tractograms. I can successfully run COMMIT, but when I switch to COMMIT2, the following command fails:

# Set the regularisation
mit.set_regularisation(
    regularisers=('group_lasso', None, None),
    is_nonnegative=(True, True, True),
    lambdas=(perc_lambda, None, None),
    params=(params_IC, None, None)
)

The error occurs because params_IC has shape (718626,) while the original tractogram (input_fibers_connecting.tck) has shape (719560,).


  File "/home/simona/work/code/Default/Ontheside/./COMMIT.py", line 185, in process_data
    mit.set_regularisation(
    ~~~~~~~~~~~~~~~~~~~~~~^
        regularisers   = ('group_lasso', None, None),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        params         = (params_IC, None, None)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "commit/core.pyx", line 1118, in commit.core.Evaluation.set_regularisation
ValueError: operands could not be broadcast together with shapes (719560,) (718626,) 

Details

The issue seems to be related to the trk2dictionary.run() step:

trk2dictionary.run(
    filename_tractogram='input_fibers_connecting.tck',
    TCK_ref_image=args.dwi_nii,
    min_seg_len=0.0000001,
    verbose=4
    # min_seg_len = 0.0,
    # blur_clust_thr = 0,
    # # filename_mask = args.wm_nii, really changes the number of streamlines in IC compartments
    # fiber_shift=0.5
)

When creating IC compartments, not all streamlines are considered. Here is the relevant log excerpt:

Creating data structure from tractogram
   * Configuration:
      - Segment position = COMPUTE INTERSECTIONS
      - Coordinates shift in X = 0.000 (voxel-size units)
      - Coordinates shift in Y = 0.000 (voxel-size units)
      - Coordinates shift in Z = 0.000 (voxel-size units)
      - Min segment len    = 1.00e-07 mm
      - Min streamline len = 0.00 mm
      - Max streamline len = 250.00 mm
      - Do not blur streamlines
      - Output written to "./COMMIT"
      - Temporary files written to "./COMMIT/temp"
      - Using parallel computation with 22 threads
   * Loading data:
      - Tractogram:
         - geometry taken from "sub-1006__dwi.nii.gz"
         - 142 x 174 x 120
         - 1.000 x 1.000 x 1.000
         - 719560 streamlines
      - No mask specified to restrict IC compartments
      - No dataset specified for EC compartments
      - No mask specified to restrict ISO compartments
   * Exporting IC compartments:
         [ 718626 streamlines kept, 76441230 segments in total ]
   * Exporting EC compartments:
         [ 0 voxels, 0 segments ]
   * Exporting ISO compartments:
         [ 1343370 voxels ]
   * Saving data structure in "./COMMIT"
   * Saving TDI and MASK maps

I tried changing many trk2dictionary parameters to reduce the mismatch between the shapes, but I cannot eliminate it completely.

Question

  • How can I ensure that params_IC matches the original tractogram?
  • Is there a way to export the streamlines from IC components?
  • Alternatively, how can I make input_fibers_connecting.tck identical to the IC components from the start?
  • If necessary, I am willing to manually create the dictionary. Can you describe how that should look like?

Any advice would be greatly appreciated!

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions