TFF_GENERATE_...OM_SCRATCH.PY(1)
πΈ NAME πΈ
tff_generate_trx_from_scratch.py β a User Commands icon, and she generates a TRX file from CSV, TXT or NPY files. periodt. π
β¨ DESCRIPTION β¨
okay bestie, first things first, here's the whole vibe:
usage: tff_generate_trx_from_scratch.py [-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 she does is generate a TRX file from a collection of CSV, TXT or NPY files, by you individually specifying positions, offsets, data_per_vertex, data_per_streamlines, groups and data_per_group. and likeβ¦ every single file has to have its data type specified by the users. that's you. yes you. π
A reference file must be provided (NIFTI), and the option --verify_invalid will remove invalid streamlines (outside of the bounding box in VOX space). slay.
π All dimensions (nbr_verticesandnbr_streamlines) and groups/dpg must match, otherwise the script will (likely) crash. like, crash crash. no cap. π
Each instance of --dps, --dpv, --groups require 2 arguments (FILE, DTYPE). --dpg requires 3 arguments (GROUP, FILE, DTYPE). The choice of DTYPE are:
(u)int8, (u)int16, (u)int32, (u)int64float16, float32, float64bool
Example command:
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 π«Ά
referenceβ the Reference anatomy for tck/vtk/fib/dpy file support (.niior.nii.gz). the blueprint, the moment, the main character. πOUT_TRACTOGRAMβ Output filename. Format must be one oftrk,tck,vtk,fib,dpy,trx. pick your fighter. π₯
π₯ options π₯
-h,--helpβ show this help message and exit. the classic. the icon.--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). π§-fβ Force overwriting of the output files. she said move, we're going in. π₯
π§ Positions options π§
--positions POSITIONSβ Binary file containing the streamlines coordinates. Must be Nx3 (.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. yes bestie, the whole comma situation. π--space {RASMM,VOXMM,VOX}β Space in which the coordinates are declared.[RASMM]Non-default option requires Dipy. π--origin {NIFTI,TRACKVIS}β Origin in which the coordinates are declared.[NIFTI]Non-default option requires Dipy.
π Data type options π
--positions_dtype {float16,float32,float64}β Specify the datatype for positions for trx.[float32]--offsets_dtype {uint32,uint64}β Specify the datatype for offsets for trx.[uint64]
π Streamlines metadata options π
--dpv FILE DTYPEβ Binary file containing data_per_vertex. Must haveNB_VERTICESas first dimension (.npy).--dps FILE DTYPEβ Binary file containing data_per_vertex. Must haveNB_STREAMLINESas first dimension (.npy). (yep, the manpage says data_per_vertex right there, we're just reporting the news π«‘)--groups FILE DTYPEβ Binary file containing a sparse group (indices). Indices should be lower thanNB_STREAMLINES(.npy).--dpg GROUP FILE DTYPEβ Binary file containing data_per_group. Must have(1,)as first dimension (.npy). one row. that's the whole flex. π
and that's the page, bestie!! π this lil masterpiece is tff_generate_trx_from_scratch.p... from the User Commands manual, dated July 2024 β go forth and generate those tractograms, you absolute legend π§β¨π
π¦ where this page comes from
- debian trixie: python3-trx-python 0.3-1 Β· BSD-2-Clause
- ubuntu questing: python3-trx-python 0.3-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms