== CAF dataset for [http://mouse.brain-map.org/launchviewer.do Allen Reference Atlas] == Detailed description of volume preprocessing: 1. Fetch `AtlasAnnotation25.sva` sparse volume file from [http://community.brain-map.org/confluence/download/attachments/525267/data.zip?version=1 ABA Website]. 2. Coordinates in this volume are expressed in [http://incf-dev.crbs.ucsd.edu/aba/atlas?service=WPS&version=1.0.0&request=Execute&Identifier=ListSRSs Mouse_ABAvoxel_1.0] (`ABAvoxel, INCF:0100`) SRS, in which units of measurements are voxels. In order to express coordinates in stereotaxic coordinates (with bregma point defined as origin of the coordinate system), the volume has to be transformed into [http://incf-dev.crbs.ucsd.edu/aba/atlas?service=WPS&version=1.0.0&request=Execute&Identifier=ListSRSs Mouse_ABAreference_1.0] SRS (`ABAreference, INCF:0101`). 3. Such transfomration is given by the [http://code.google.com/p/incf-dai/wiki/AtlasRequestInterfaceSpec#TransformPOI TransfomPOI] INCF DAI service (ie. [http://incf-dev.crbs.ucsd.edu/aba/atlas?service=WPS&version=1.0.0&request=Execute&Identifier=TransformPOI&DataInputs=transformationCode=Mouse_ABAvoxel_1.0_To_Mouse_ABAreference_1.0_v1.0;x=1;y=112;z=162 this request]). 4. Tranformation may be calculated from 4 points in `ABAvoxel` SRS (`p1, p2, p3, p4`) and 4 corresponding point in `ABAreference` SRS (`p1', p2', p3', p4'`) by solving following equation: [[Image(gif.latex.gif)]] After all, matrix '''M''' is: {{{ M= [[ 2.71693750e-02 -8.17542750e-05 -5.01197500e-04 -1.25701700e+00] [ 8.92628250e-04 2.82020000e-02 -2.71143000e-04 -1.28628500e+00] [ -5.86774750e-04 -8.96920500e-04 -2.59281250e-02 6.04778000e+00] [ 0.00000000e+00 1.73472348e-18 0.00000000e+00 1.00000000e+00]] }}} and '''M'''': {{{ M'= [[ 1.00000000e+00 -2.89888217e-03 -1.93302640e-02 -1.25701700e+00] [ 3.28542063e-02 1.00000000e+00 -1.04574858e-02 -1.28628500e+00] [ -2.15969175e-02 -3.18034359e-02 -1.00000000e+00 6.04778000e+00] [ 0.00000000e+00 6.15106544e-17 0.00000000e+00 1.00000000e+00]] }}} {{{#!comment \\ \mathbf{V}=\begin{bmatrix} p_1[1] & p_2[1] & p_3[1] & p_4[1] \\ p_1[2] & p_2[2] & p_3[2] & p_4[2]\\ p_1[3] & p_2[3] & p_3[3] & p_4[3]\\ 1 & 1 & 1 & 1 \end{bmatrix} \\ \\ \mathbf{V'}=\begin{bmatrix} p'_1[1] & p'_2[1] & p'_3[1] & p'_4[1] \\ p'_1[2] & p'_2[2] & p'_3[2] & p'_4[2]\\ p'_1[3] & p'_2[3] & p'_3[3] & p'_4[3]\\ 1 & 1 & 1 & 1 \end{bmatrix} \\ \mathbf{M} = \mathbf{V'} \mathbf{V^{-1}} \\ \\ \textup{And normalizing so the all diagonal elements are equal to 1:} \\ \mathbf{M_c} = \begin{bmatrix} |\mathbf{M}_{1,1}|^{-1} & 0 & 0 & 0\\ 0 & |\mathbf{M}_{2,2}|^{-1} & 0 & 0\\ 0 & 0 & |\mathbf{M}_{3,3}|^{-1} & 0\\ 0 & 0 & 0 & 1 \end{bmatrix} \\ \mathbf{M'} =\mathbf{M} \mathbf{M_c} }}} Then, initial volume `AtlasAnnotation25.sva` is transformed using '''M'''' and the resulting volume is used by the 3dBAR parser to create CAF dataset. Below you may find comparison of brain outlines created using raw volume (dark gray) and volume after transformation (light gray): [[Image(ss1.png)]] [[Image(ss2.png)]] [[Image(ss3.png)]]