Research Ideas and Outcomes : Project Report
|
Corresponding author: Julia M Huntenburg (ju.huntenburg@gmail.com)
Received: 20 Feb 2017 | Published: 23 Feb 2017
© 2017 Julia Huntenburg, Konrad Wagstyl, Christopher Steele, Thomas Funck, Richard Bethlehem, Ophélie Foubet, Benoit Larrat, Victor Borrell, Pierre-Louis Bazin
This is an open access article distributed under the terms of the Creative Commons Attribution License (CC BY 4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Citation: Huntenburg J, Wagstyl K, Steele C, Funck T, Bethlehem R, Foubet O, Larrat B, Borrell V, Bazin P (2017) Laminar Python: tools for cortical depth-resolved analysis of high-resolution brain imaging data in Python. Research Ideas and Outcomes 3: e12346. https://doi.org/10.3897/rio.3.e12346
|
![]() |
Increasingly available high-resolution brain imaging data require specialized processing tools that can leverage their anatomical detail and handle their size. Here, we present user-friendly Python tools for cortical depth resolved analysis in such data. Our implementation is based on the CBS High-Res Brain Processing framework, and aims to make high-resolution data processing tools available to the broader community.
laminar analysis, high-resolution MRI
Recent advances in ultra-high field and quantitative MRI facilitate non-invasive imaging of the whole brain at an unprecedented level of detail (
In this project, we made a subset of CBSTools modules available in Python (https://github.com/juhuntenburg/laminar_python,
Our aim was to provide user-friendly Python interfaces to the CBSTools modules and make these available in a platform independent manner with minimal dependencies. We used the JCC package (http://lucene.apache.org/pylucene/jcc/index.html) to encapsulate the original Java classes. We then implemented a set of Python wrapper functions which convert the input data to Java data structures, initiate a Java virtual machine, call the main Java class with the specified parameters, collect, convert and return the output data.
Input and output data can either be passed as files or specific Python data structures. We chose to represent volumetric data as Nibabel SpatialImages (http://nipy.org/nibabel/reference/nibabel.spatialimages.html), in particular Nifti1Images. These standardized objects simplify data exchange with other software tools. Finding a solution to represent surface data proved to be more difficult, since neither a community standard, nor a suitable precedent solution in other Python tools exists. Here, we decided to represent a surface mesh as a dictionary with the entries coords, an array containing the coordinates of the mesh vertices, and faces, an array containing the vertex indices of the mesh faces.
Functions for loading and saving of volumetric and surface mesh data in various file formats (currently nifti, gifti, ply, vtk, obj and Freesurfer formats) can be called directly by the user, but are also employed by the main processing functions. The loading functions automatically determine the input type: supported file formats are loaded and Python data structures are tested for compliance with the expected pattern. This approach is inspired by the input and output management in Nilearn. It makes it easy for the user to call the main functions directly on their data files, without further specifications. At the same time, it is flexible to accommodate non-standard data formats, which the user can load into the appropriate Python data structure with custom scripts.
The set of functions implemented in this package enables sampling of a given intensity image on multiple intracortical laminae, starting from a simple tissue classification. We illustrated their usage in an example workflow (https://github.com/juhuntenburg/laminar_python/blob/master/examples/laminar_python_demo.ipynb). Here, the initial inputs are two binary images demarcating the inner and outer boundary of the cortical grey matter of a ferret (Mustela putorius furo) brain (Fig.
Laminar python pipeline, demonstrated using high-resolution MR data of a ferret brain. a) Binary images demarcating inner (grey-white matter interface, top) and outer (pial surface, bottom) boundaries of the cortex. b) Levelset representations of the same surfaces, where positive values are assigned to voxels outside of the volume deliminated by the surface, and negative values to voxels inside, each increasing in value with euclidean distance from the surface. c) Continuous equivolumetric intracortical depth, which models the positions of laminae relative to cortical morphology. d) Discrete representations of equivolumetric depth levels. e) T2 values, sampled at the six equivolumetric intracortical depths. Note that the equivolumetric laminae do not represent architectonic layers, but provide an anatomically meaningful coordinate system of cortical depth.
The example data is taken from a 7 Tesla MR scan of an adult ferret (voxel size = 120 µm isotropic). With no additional manipulation, the package was readily applied to the animal data, testifying that it can also be used for cross-species analysis. Nilearn plotting functions were used for visualization, demonstrating the straightforward integration between the two packages.
The current stage of the project faces several limitations, which might be overcome in future work. First, we focused on a subset of CBSTools modules. A more complete migration of CBSTools functionality to Python is a logical next step. Second, platform independence has not yet been achieved and requires pre-compilation of the JCC wrappers on different platforms. Third, atlases, lookup tables and example data are currently located within the GitHub repository. Better solutions for providing these files and other relevant datasets to the user should be found in the long term. Fourth, while our approach ensures general compatibility with other Python-based neuroimaging software, we aim for a closer integration, for instance by providing Nipype interfaces. Fifth, CBSTools are mainly used for processing MRI data, but are generally applicable to other types, such as histological data. It would be interesting to expand usability to different data types and provide respective examples.
We encapsulated a subset of CBSTools in Python and implemented user-friendly interfaces for the laminar analysis of high-resolution MR images. This is a first step to making high-resolution data processing tools available to the broader community, which also aims to encourage other scientists to contribute with their own code.
This work was completed during OHBM Hackathon Lausanne 2016 and Brainhack Anatomy Paris 2016.
JMH and PLB conceived the project. JMH, KW, CJS, TF and PLB contributed to the code. RAIB and OF tested the code and gave feedback for revision. JMH wrote the initial draft of the manuscript. KW, CJS, TF, RB, OF and PLB revised the manuscript. OF, BL and VB provided the example data.
None declared.