{"id":28089067,"url":"https://github.com/tractor/tractor","last_synced_at":"2025-05-13T12:53:28.642Z","repository":{"id":46697364,"uuid":"2159820","full_name":"tractor/tractor","owner":"tractor","description":"Magnetic resonance imaging and tractography with R","archived":false,"fork":false,"pushed_at":"2025-05-09T20:39:07.000Z","size":111185,"stargazers_count":28,"open_issues_count":2,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-09T21:33:11.943Z","etag":null,"topics":["brain-imaging","graph-algorithms","parcellation","r","tractography"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tractor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-08-05T11:01:35.000Z","updated_at":"2025-04-23T20:52:12.000Z","dependencies_parsed_at":"2024-10-25T21:04:56.623Z","dependency_job_id":"1ef0cc9d-27ca-4f9e-9584-541b4e94daaf","html_url":"https://github.com/tractor/tractor","commit_stats":null,"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tractor%2Ftractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tractor%2Ftractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tractor%2Ftractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tractor%2Ftractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tractor","download_url":"https://codeload.github.com/tractor/tractor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253328806,"owners_count":21891530,"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","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":["brain-imaging","graph-algorithms","parcellation","r","tractography"],"created_at":"2025-05-13T12:53:28.179Z","updated_at":"2025-05-13T12:53:28.624Z","avatar_url":"https://github.com/tractor.png","language":"C++","readme":"[![CI](https://github.com/tractor/tractor/actions/workflows/ci.yaml/badge.svg)](https://github.com/tractor/tractor/actions/workflows/ci.yaml) [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.10010.svg)](http://dx.doi.org/10.5281/zenodo.10010)\n\nTractoR is an [R-based](http://www.r-project.org) platform for medical image processing, tractography and graph analysis. It is focussed on handling magnetic resonance images, but many of its core functions are applicable to any kind of image. The package is full-stack free and open-source, as R is itself free software, and it is easy to extend and build upon. Downloads are available from the [project web site](https://www.tractor-mri.org.uk/downloads).\n\n## Overview\n\nThere are several sources of documentation available. For installation instructions, please see the `INSTALL.md` file. For general information on the package, its capabilities and conventions, please see the [TractoR paper](https://www.jstatsoft.org/v44/i08/) and/or the [project home page](https://www.tractor-mri.org.uk). The latter is mirrored in the TractoR distribution, and can be found at `share/doc/home.html`. Standard R documentation is available, function by function, for the core `tractor.base` package and all first- and third-party dependency packages (which are included in the main download).\n\nPlease see below for information on\n\n- [usage from R](#usage-from-r) and\n- [usage outside R](#usage-outside-r),\n\ndepending on your preference.\n\n## Usage from R\n\nUsers who are already familiar with R can easily incorporate the functionality of TractoR's R packages into their work. For example, an MRI image can be read from a compressed [NIfTI-1](http://nifti.nimh.nih.gov/nifti-1) file, and its key metadata displayed with\n\n```r\nt1 \u003c- readImageFile(\"refT1.nii.gz\")\nt1\n#      Image source : /usr/local/tractor/tests/data/session/tractor/structural/refT1\n#  Image dimensions : 176 x 232 x 256 voxels\n#  Voxel dimensions : 1 x 1 x 1 mm\n# Coordinate origin : (91.89,94.98,106.1)\n#   Additional tags : (none)\n#        Sparseness : 10.03% (dense storage)\n```\n\nThe `t1` object can in many ways be treated as a standard R array, but it can also be manipulated and visualised with a set of specialised functions.\n\nA parcellation in the same space can be loaded and overlaid in an interactive viewer using\n\n```r\nparc \u003c- readImageFile(\"parcellation.nii.gz\")\nshowImagesInViewer(t1, parc)\n```\n\n![Parcellation overlaid on brain](https://www.tractor-mri.org.uk/parcellation.png)\n\n(with the `tractor.session` package loaded). Notice that both the numerical index and the name of the region currently under the crosshair is given in the info panel at the bottom right.\n\nWe can also apply image processing operations to the image and then visualise the result. In the example below we create a diamond-shaped 3D kernel, and then calculate and visualise the [morphological gradient](https://github.com/jonclayden/mmand#greyscale-morphology) of the original image.\n\n```r\nk \u003c- shapeKernel(c(3,3,3), type=\"diamond\")\ngrad \u003c- t1$copy()$map(function(x) dilate(x,k) - erode(x,k))\nshowImagesInViewer(grad)\n```\n\n![Morphological gradient of brain image](https://www.tractor-mri.org.uk/gradient.png)\n\nNotice the use of the `map()` method, which can be used to replace the data in an image with the result of applying a function, in this case an anonymous function constructed within the call.\n\n## Usage outside R\n\nUsers who are not familiar with R, or wish to perform common tasks quickly, can instead use TractoR's direct command-line interface, which is simpler to use and requires less typing, but is still very flexible. A list of available commands can be obtained with\n\n```shell\ntractor list\n# Starting TractoR environment...\n# Experiment scripts found in /usr/local/tractor/share/experiments:\n#  [1] age             apply           bedpost         binarise       \n#  [5] chfiletype      clone           components      compress       \n#  [9] console         dicomread       dicomsort       dicomtags      \n# [13] dirviz          dpreproc        extract         freesurf       \n# [17] gradcheck       gradread        gradrotate      graph-build    \n# [21] graph-decompose graph-extract   graph-props     graph-reweight \n# [25] graph-viz       graph2csv       hnt-eval        hnt-interpret  \n# [29] hnt-ref         hnt-viz         imageinfo       imagestats     \n# [33] import          list            mean            mkroi          \n# [37] morph           parcellate      path            peek           \n# [41] platform        plotcorrections pnt-data        pnt-em         \n# [45] pnt-eval        pnt-interpret   pnt-prune       pnt-ref        \n# [49] pnt-train       pnt-viz         reg-apply       reg-check      \n# [53] reg-info        reg-linear      reg-nonlinear   reg-viz        \n# [57] reshape         slice           smooth          split          \n# [61] status          tensorfit       track           transform      \n# [65] trim            update          values          view  \n# \n# Experiment completed with 0 warning(s) and 0 error(s)\n```\n\nInformation on usage of a particular script, and the options that it supports, is available by using the '-o' command-line flag.\n\n```shell\ntractor -o imagestats\n# OPTIONS for script /usr/local/tractor/share/experiments/imagestats.R (* \n# required)\n#    Scope: nonzero [zero,positive,negative,all]\n#    MaskFile: NULL\n#    ThresholdLevel: 0\n# ARGUMENTS: image file\n# \n# DESCRIPTION:\n# Print various statistics of the specified image, optionally limiting the \n# calculations by voxel value or by mask. The 5% trimmed range is obtained by \n# discarding the 5% largest and smallest values and taking the range of the \n# remainder, thereby giving an indication of the influence of extreme values. \n# This script may currently only be applied to 3D images.\n```\n\nRunning a particular script is a matter of typing `tractor`, followed by the script's name and any arguments or named options required. For example,\n\n```shell\ntractor graph-viz data/graph/diffusion ShowBrain:true\n```\n\n![Morphological gradient of brain image](https://www.tractor-mri.org.uk/graph.png)\n\nThe examples in the previous section can be replicated in this way by using the `imageinfo` and `view` scripts. Try it! Further information on the `tractor` command is available from its `man` page, by typing `man tractor`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftractor%2Ftractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftractor%2Ftractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftractor%2Ftractor/lists"}