Skip to content

Commit

Permalink
add FAFB14 mirror registration
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Jan 10, 2021
1 parent 825c6d7 commit 1509b0a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 5 deletions.
22 changes: 19 additions & 3 deletions flybrains/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@
from navis import transforms

import numpy as np
import pandas as pd

from .download import get_data_home

__all__ = ['register_transforms', 'report']

# Read in meta data
fp = os.path.dirname(__file__)

data_filepath = os.path.join(fp, 'data')


@functools.lru_cache()
def get_nat_regdirs(verbose=False):
Expand Down Expand Up @@ -229,10 +235,10 @@ def register_transforms():
transform_type='bridging')

# Add transform between JRCFIB2018F (nm) and JRCFIB2018Fum (um)
tr = transforms.affine.AffineTransform(np.diag([1/1e3, 1/1e3, 1/1e3, 1]))
tr = transforms.affine.AffineTransform(np.diag([1e3, 1e3, 1e3, 1]))
transforms.registry.register_transform(transform=tr,
source='JRCFIB2018F',
target='JRCFIB2018Fum',
source='JRCFIB2018Fum',
target='JRCFIB2018F',
transform_type='bridging')

# Add transform between FAFB14um and FAFB14 (nm)
Expand All @@ -255,3 +261,13 @@ def register_transforms():
source='JFRC2',
target='JFRC2010',
transform_type='bridging')

# Add a simple mirror transform for FAFB14
fp = os.path.join(data_filepath, 'FAFB14_mirror_landmarks.csv')
lm = pd.read_csv(fp)
tr = transforms.thinplate.TPStransform(lm[['x_mirr', 'y_mirr', 'z_mirr']].values,
lm[['x', 'y', 'z']].values)
transforms.registry.register_transform(transform=tr,
source='FAFB14',
target=None,
transform_type='mirror')
27 changes: 27 additions & 0 deletions flybrains/data/FAFB14_mirror_landmarks.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
label,x,y,z,side,x_mirr,y_mirr,z_mirr,original_side
antler,587201,182007,185345,L,568923,179977,195734,R
dimple1,697109,222823,58876,L,705480,205422,106682,R
dimple2,607100,104989,138065,L,586352,98028,150176,R
dimple3,622471,308005,144728,L,608265,304754,157541,R
dimple4,643639,214585,66168,L,645039,199521,93013,R
LH,733031,146563,152677,L,721699,134702,182934,R
MB1,692958,172890,65884,L,681095,154893,102163,R
MB2,599003,93341,76730,L,591704,85278,90487,R
peak,619804,294979,53835,L,630690,275831,66134,R
SEZ,559790,317818,37401,L,561715,311357,47117,R
vis1,730150,189507,204076,L,731312,183857,235749,R
vis2,680242,344243,170947,L,680339,325281,203112,R
vis3,767124,306692,219120,L,801424,285944,270713,R
antler,476963,179977,195734,R,458685,182007,185345,L
dimple1,340406,205422,106682,R,348777,222823,58876,L
dimple2,459534,98028,150176,R,438786,104989,138065,L
dimple3,437621,304754,157541,R,423415,308005,144728,L
dimple4,400847,199521,93013,R,402247,214585,66168,L
LH,324187,134702,182934,R,312855,146563,152677,L
MB1,364791,154893,102163,R,352928,172890,65884,L
MB2,454182,85278,90487,R,446883,93341,76730,L
peak,415196,275831,66134,R,426082,294979,53835,L
SEZ,484171,311357,47117,R,486096,317818,37401,L
vis1,314574,183857,235749,R,315736,189507,204076,L
vis2,365547,325281,203112,R,365644,344243,170947,L
vis3,244462,285944,270713,R,278762,306692,219120,L
7 changes: 7 additions & 0 deletions flybrains/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ However, they are in raw voxel coordinates.
In contrast, X1,Y1,Z1 (which contain locations in FAFB space) are in nm.

See https://github.com/saalfeldlab/elm for the original source of the landmarks.

`FAFB14_mirror_landmarks.csv` contains landmarks to compensate for left/right
asymmetries in FAFB14. Pairs of landmarks (e.g. "antlers L" and "antler R")
were placed manually to approximately corresponding locations on the left and
right hemisphere. To generate a mirror transform, for each landmark (e.g.
"antlers L") the corresponding landmark on the other side (e.g. "antlers R")
was mirrored to the same side using an affine transform.
4 changes: 2 additions & 2 deletions flybrains/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,11 +640,11 @@ class _JRCVNC2018F(FlyTemplateBrain):
The JRCVNC2018U reference VNC was constructed as for JRCVNC2018F VNC but
pooling both male and female brains.
JRCVNC2018F.surf, was generated in Amira from a 2 micron downsampled,
The JRCVNC2018F mesh, was generated in Amira from a 2 micron downsampled,
Lanczos filtered version of the respective template VNC. A surface was then
generated with a threshold level of 2800 and then smoothed and downsampled.
JRCVNC2018U.surf, was generated in Amira from a 2 micron downsampled,
The JRCVNC2018U mesh, was generated in Amira from a 2 micron downsampled,
Lanczos filtered 8 bit version of the respective template VNC. A surface was
then generated with a threshold level of 20 and then smoothed and
downsampled.
Expand Down

0 comments on commit 1509b0a

Please sign in to comment.