{"id":29746407,"url":"https://github.com/imeka/trk-io","last_synced_at":"2025-07-26T07:13:46.758Z","repository":{"id":26921524,"uuid":"111929644","full_name":"imeka/trk-io","owner":"imeka","description":"TrackVis (*.trk) reader and writer","archived":false,"fork":false,"pushed_at":"2025-06-19T17:36:42.000Z","size":280,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-20T21:07:22.585Z","etag":null,"topics":["diffusion-mri","rust","trackvis","trk"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imeka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-11-24T14:56:48.000Z","updated_at":"2025-06-19T17:36:45.000Z","dependencies_parsed_at":"2023-01-14T05:37:11.639Z","dependency_job_id":"41669917-2ae7-4cf5-891d-a7a9ae28b368","html_url":"https://github.com/imeka/trk-io","commit_stats":{"total_commits":327,"total_committers":3,"mean_commits":109.0,"dds":"0.18960244648318048","last_synced_commit":"c19b7ed81abf3800d8b002fe55153b70984d69aa"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/imeka/trk-io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imeka%2Ftrk-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imeka%2Ftrk-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imeka%2Ftrk-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imeka%2Ftrk-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imeka","download_url":"https://codeload.github.com/imeka/trk-io/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imeka%2Ftrk-io/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267133958,"owners_count":24040789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diffusion-mri","rust","trackvis","trk"],"created_at":"2025-07-26T07:13:46.177Z","updated_at":"2025-07-26T07:13:46.747Z","avatar_url":"https://github.com/imeka.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trk-io \u0026emsp; [![Latest Version](https://img.shields.io/crates/v/trk_io.svg)](https://crates.io/crates/trk-io) [![Coverage](https://codecov.io/gh/imeka/trk-io/branch/master/graph/badge.svg)](https://codecov.io/gh/imeka/trk-io) [![Build Status](https://travis-ci.org/imeka/trk-io.svg?branch=master)](https://travis-ci.org/imeka/trk-io) [![dependency status](https://deps.rs/repo/github/imeka/trk-io/status.svg)](https://deps.rs/repo/github/imeka/trk-io)\n\n`trk-io` implements a `TrackVis` (.trk) reader and writer.\n\n## Highlights\n\n- Can read and write `TrackVis` files. Handles affine transformation as\n  ``nibabel.streamlines`` and ``MI-Brain`` would.\n- Reading and writing is tested as much as in ``nibabel.streamlines``.\n- Can optionally use the ``nifti-rs`` crate, which can then be used to create a\n  trk header from a ``NiftiHeader``, like you would do in ``nibabel``\n- ``Reader`` can read all streamlines at once or can be used as a generator.\n- Scalars and properties are supported when reading and writing trk. You can\n  find some examples in ``trk_color.rs``.\n- Write all at once or streamline per streamline.\n- Follows ``nibabel.streamlines`` architecture (all 3D points are in a single\n  ``Vec![Point3D]``). Currently, this is only useful for performance, but it may\n  lead to easier changes when and if we support BLAS.\n- Handles endianness.\n- Some useful tools are coded in `examples/*.rs`. It's a good way to learn how\n  to use this library.\n\n## Examples\n\n```rust\n// Read complete streamlines to memory\nlet tractogram = Reader::new(\"bundle.trk\").unwrap().read_all();\nfor streamline in \u0026tractogram.streamlines {\n    println!(\"Nb points: {}\", streamline.len());\n    for point in streamline {\n        println!(\"{}\", point);\n    }\n}\n```\n```rust\n// Simple read/write. Using a generator, so it will load only\n// one streamline in memory.\nlet reader = Reader::new(\"full_brain.trk\").unwrap();\nlet mut writer = Writer::new(\n    \"copy.trk\", Some(reader.header.clone()));\nfor tractogram_item in reader.into_iter() {\n    // tractogram_item is a TractogramItem, which is a tuple of\n    // (streamline, scalars, properties).\n    writer.write(tractogram_item);\n}\n// The new file will be completed only at the end of the scope. The\n// 'n_count' field is written in the destructor because we don't\n// know how many streamlines the user will write.\n```\n\n## Roadmap\n\nThere's still a lot of work to do but it should work perfectly for simple use cases. In particular, future versions should be able to:\n\n- Support TCK reading/writing\n- Create some binary tools using this lib, e.g. show_affine, count_tracks, pruning, strip_info, etc.\n- Support for `ops.Range`, e.g. `streamlines[0..10]`\n\nYour help is much appreciated. Consider filing an [issue](https://github.com/imeka/trk-io/issues) in case something is missing for your use case to work. Pull requests are also welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimeka%2Ftrk-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimeka%2Ftrk-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimeka%2Ftrk-io/lists"}