flatpath
: C code to compute streamlines and streamline-derived quantities.metrics
: Python code to compute flatmap metrics.surf_cgal
: C++ code using CGAL to work with meshes (flattening, etc.).utils
: Python helper scripts to perform various tasks.
- Gather dependencies (listed below).
- Change directory to
code
. - Set environment variable
CGAL_ROOT
to the location of CGAL source code. - Run
make
!
The flatmapping workflow is implemented using Makefiles. Each stage has multiple steps, each with clearly defined input
and output
files. The workflow is designed to be self-contained, and no user modification of files is required (except possibly paths to binaries in config.mk
).
01_stageI
: run stage I "flat mesh generation", independent from stage II.02_stageII
: run stage II "voxel projection", independent from stage I.03_stageIII
: run stage III "flatmap generation", depends on stages I and II.postproc
: perform post-processing tasks, with the flatmap generated in stage III.metrics
: compute metrics for flatmap characterization, with the flatmap generated in stage III.applications
: implement applications of flatmaps, with the flatmap generated in stage III.
- Fire up a terminal.
- Clone this repository.
- Compile the code as explained above.
- Setup a Python environment using the provided
requirements.txt
file and activate it. - Set the environment variable
ATLAS_ENHANCEMENT_ROOT
to the location of the local clone of this repository. - Set the environment variable
USER_DATA_ROOT
to the location of the directory containing the input files. - Change directory to
$ATLAS_ENHANCEMENT_ROOT/flatmap/workflow
. - Run
make
!
Input data must be in NRRD format with same dimensions as flatmap, e.g. data registered to CCFv3 at 10 μm when using mouse isocortex flatmap at 10 μm.
As part of the workflow:
- Change directory to
applications/flatview_3d_data
. - Run
make FLATVIEW_DATA_INPUT_FILE="<path to input data>"
. - Extra arguments to
flatplot
can be passed in the variableFLATPLOT_DATA_EXTRA
. - Find output image under
output/
.
Stand-alone:
- The flatplot script can be found in
$ATLAS_ENHANCEMENT_ROOT/flatmap/code/utils/flatplot.py
. - Run it like
flatplot <flatmap NRRD> <data NRRD> <output prefix>
. - Some common options are:
--flatpix
: specify pixel resolution of output image--autospan
: get value range from data, instead of [0,1]--colormap
: set color map fromcolorcet
ascet:*
, fromseaborn
assns:*
, fromcmcrameri
ascmc:*
, or as a comma-separated list of hexadecimal RGB colors (#XXXXXX
)--reduction
: specify aggregation function, e.g.max
,mean
, etc.--layers
: path to layers NRRD (1-based integers), to be used with--split
to plot each layer separately, or--only-layer
to plot a specific layer.
- For full CLI options, run
flatplot --help
.
NRRD datasets must include voxel dimensions and space origin metadata, and must have the same data dimensions. Check files in Zenodo repo for examples. Preferably generate/save these files using the Python package voxcell
.
config.mk
: configuration file for the flatmapping algorithm. For example, see the provided user_config_sscx.mk or user_config_isocortex.mk.relative_depth.nrrd
: relative depth field as 32-bit floating-point NRRD dataset. Values must be 1 at the top shell and 0 at the bottom shell. Background value must be NaN.orientation_{x,y,z}.nrrd
: components of the local orientation vector as 32-bit floating-point NRRD datasets. Background value must be 0. The vector must point towards the top shell (whererelative_depth.nrrd
is 1).annotations.nrrd
(optional): sequential region labels as an integer NRRD dataset. Used to visualize region annotations in flat space inapplications/flatview_annotations
.mask.nrrd
(optional): labeling of inner (1) and outer (0) voxels, and top (4) / sides (2) / bottom (3) shells, as an integer NRRD dataset.hemispheres.nrrd
(optional): labeling of right (1) and left (2) hemispheres, as an integer NRRD dataset. Used to mirror flatmaps inpostproc/both_hemispheres
.
- GNU Make (
make
) - C compiler (
gcc
orclang
) - C++ compiler (
g++
orclang++
) - CMake (
cmake
) - CGAL v5.6+ (website)
- Boost (
libboost-dev
) - Eigen3 (
libeigen3-dev
) - GMP (
libgmp-dev
) - MPFR (
libmpfr-dev
) - GMSH (
gmsh
, website) - Python packages in
requirements.txt
Requires copying the following files from my branch (until CGAL/cgal#8180 is merged):
Convex_border_parameterizer_3.h
Parametric_curve_border_parameterizer_3.h
into include/CGAL/Surface_mesh_parameterization
in the CGAL source distribution.
- Intel MKL (proprietary), to speed up iterative mesh flattening with PARDISO solver.
- GNU Parallel (
parallel
), to compute streamlines in parallel. - gnuplot (
gnuplot
), to view diagnostic plots. - Some image viewer (e.g.,
feh
), to view generated heatmaps. - Some NRRD viewer (e.g.,
xgrid3d
oritk-snap
), to view generated NRRD datasets.