USAGE:(1)
β¨ NAME β¨
okay so bestie, welcome to USAGE:(1) π β this is the manual page for usage: tff_generate_trx_from_scratch [-h] [--positions POSITIONS]. Yeah the name is a whole vibe, it's literally a usage string wearing a manpage as a little outfit. We move.
πΈ DESCRIPTION πΈ
Here's the synopsis, no cap, every flag present and accounted for:
usage: tff_generate_trx_from_scratch [-h] [--positions POSITIONS]
[--offsets OFFSETS] [--positions_csv POSITIONS]
[--space {RASMM,VOXMM,VOX}]
[--origin {NIFTI,TRACKVIS}]
[--positions_dtype {float16,float32,float64}]
[--offsets_dtype {uint32,uint64}]
[--dpv FILE DTYPE] [--dps FILE DTYPE]
[--groups FILE DTYPE] [--dpg GROUP FILE DTYPE]
[--verify_invalid] [-f] reference OUT_TRACTOGRAM
So what does it do? It generates a TRX file out of a whole lil collection of CSV, TXT or NPY files π β and you do that by individually specifying positions, offsets, data_per_vertex, data_per_streamlines, groups and data_per_group. And every single file has to have its data type specified by you, the user. No autodetection fairy is coming to save you, bestie, you're the main character here π
A reference file must be provided (NIFTI, okay?), and the option --verify_invalid will remove invalid streamlines β meaning the ones hanging outside of the bounding box in VOX space. Rude of them but okay. πͺ
β οΈ real talk: All dimensions (nbr_vertices and nbr_streamlines) and groups/dpg must match. Otherwise the script will (likely) crash. Not "might get a lil weird" β crash. The "(likely)" is doing so much heavy lifting there it's practically a gym influencer. π
Every instance of --dps, --dpv, --groups requires 2 arguments (FILE, DTYPE). --dpg requires 3 arguments (GROUP, FILE, DTYPE). And the choice of DTYPE are:
(u)int8,(u)int16,(u)int32,(u)int64float16,float32,float64bool
π¦ Example command π¦
She's long, she's gorgeous, she ate:
tff_generate_trx_from_scratch.py fa.nii.gz generated.trx -f
--positions test_npy/positions.npy
--positions_dtype float16
--offsets test_npy/offsets.npy
--offsets_dtype uint32
--dpv test_npy/dpv_cx.npy uint8
--dpv test_npy/dpv_cy.npy uint8
--dpv test_npy/dpv_cz.npy uint8
--dps test_npy/dps_algo.npy uint8
--dps test_npy/dps_cw.npy float64
--groups test_npy/g_AF_L.npy int32
--groups test_npy/g_AF_R.npy int32
--dpg g_AF_L test_npy/dpg_AF_L_mean_fa.npy float32
--dpg g_AF_R test_npy/dpg_AF_R_mean_fa.npy float32
--dpg g_AF_L test_npy/dpg_AF_L_volume.npy float32
π POSITIONAL ARGUMENTS π
These two are mandatory, they're the moment, they're non-negotiable:
referenceβ Reference anatomy fortck/vtk/fib/dpyfile support (.niior.nii.gz). Basically the anatomical blueprint the whole thing gets aligned to π§OUT_TRACTOGRAMβ Output filename. Format must be one oftrk,tck,vtk,fib,dpy,trx. Pick your fighter, but pick one that's on the list. No freestyling π
π OPTIONS π
-h,--helpβ show this help message and exit. The classic. The icon. The "I got lost and I'm not ashamed" button π«Ά--verify_invalidβ Verify that the positions are all valid. None outside of the bounding box in VOX space. Requires Dipy (due to use of SFT). She's thorough and she needs her dependency, respect her π-fβ Force overwriting of the output files. Careful babe, this is the "yes I really mean it, delete the old one" flag. She does not ask twice, she just overwrites. π₯
π¦ POSITIONS OPTIONS π¦
--positions POSITIONSβ Binary file containing the streamlines coordinates. Must beNx3(.npy) β¨--offsets OFFSETSβ Binary file containing the streamlines offsets (.npy) π--positions_csv POSITIONSβ CSV file containing the streamlines coordinates. Rows for each streamlines organized asx1,y1,z1, x2,y2,z2,...,xN,yN,zNπ--space {RASMM,VOXMM,VOX}β Space in which the coordinates are declared.[RASMM]is the default. Non-default option requires Dipy π--origin {NIFTI,TRACKVIS}β Origin in which the coordinates are declared.[NIFTI]is the default. Non-default option requires Dipy π§
π DATA TYPE OPTIONS π
--positions_dtype {float16,float32,float64}β Specify the datatype for positions for trx.[float32]is the default π--offsets_dtype {uint32,uint64}β Specify the datatype for offsets for trx.[uint64]is the default π
π STREAMLINES METADATA OPTIONS π
--dpv FILE DTYPEβ Binary file containingdata_per_vertex. Must haveNB_VERTICESas first dimension (.npy) π¦--dps FILE DTYPEβ Binary file containingdata_per_vertex. Must haveNB_STREAMLINESas first dimension (.npy) π¦
ngl the original text saysdata_per_vertexhere even though this flag is thedata_per_streamlinesone β I'm just the messenger, I report the lore exactly as it was handed to me π
--groups FILE DTYPEβ Binary file containing a sparse group (indices). Indices should be lower thanNB_STREAMLINES(.npy) πΈ--dpg GROUP FILE DTYPEβ Binary file containingdata_per_group. Must have(1,)as first dimension (.npy) πΈ
π AND THEN THE PAGE JUST... DOES THIS π
There's a second, lonely little usage fragment hanging out in there, exactly like this:
[--offsets OFFSETS]
[--positions_csv POSITIONS] [--space {RASMM,VOXMM,VOX}] [--origin
{NIFTI,TRACKVIS}] [--positions_dtype {float16,float32,float64}]
[--offsets_dtype {uint32,uint64}] [--dpv FILE DTYPE] [--dps FILE
DTYPE] [--groups FILE DTYPE] [--dpg GROUP FILE DTYPE]
[--verify_invalid] [-f] reference OUT_TRACTOGRAM
And then, because the vibes weren't chaotic enough, the error message is just sitting there at the bottom:
tff_generate_trx_from_scratch: error: the following arguments are required: reference, OUT_TRACTOGRAM
Translation: if you forget reference or OUT_TRACTOGRAM, she's gonna yell at you. Just give her both, it's not that deep π
and that's the whole page bestie, you ate that reading, go generate some tractograms β¨
Sign-off, as is tradition: this page is usage: tff_generate_trx_from_..., dated September 2025, and it answers to the name USAGE:(1). ππ
π¦
π¦ where this page comes from
- fedora 43: python3-trx-python 0.3-9.fc43 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms