{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# A first segmentation\n", "\n", "In the previous chapter we examined a single streamline. In this chapter we will perform a \"segmentation\" of sorts, wherein we divide up the whole brain tractogram. One of the challenges we experienced in the previous chapter was that the whole brain tractogram is unwieldy and impenetrable. What we need is the ability to look at specific sub-components of the tractogram in order to systematically make insights about our model of the brain's white matter. But how would we do this? We can find the answer to this by reflecting on our earlier work with satellite images. \n", "\n", "### Making a tractogram tractable\n", "\n", "**How could we systematically divide up the white matter?**\n", "\n", "As we seek to make our tractogram more manageable we find ourselves in a position similar to the one we were in when considering the satellite images. Although we have an intuitive understanding with the familiar geography depicted in the satellite image, we nonetheless needed to narrow our consideration of the available data in order to make good use of it. In the satellite case we performed an ocean-based mask, and in the NiFTI case we used an existing parcellation. But how would we do this with a whole brain tractogram? \n", "\n", "Perhaps we can leverage an analogy with the highway system of the United States. If we consider the various regions of the brain (e.g. the ones we find in a parcellation) to be like the states of the United States, and the white matter to be the roads and highways that connect them, an approach presents itself. We could perform a systematc process of pairwise matching wherein, for each pairing of states, we identify those roads and highways (or streamlines) that start and/or finish in those areas. After all, both white matter tracts and roads have to begin and end somewhere.\n", "\n", "To achieve our goal of tractogram sub-selection we can leverage the parcellation data we were looking at previously. This data object assigns each voxel a label, and so we can--for each streamline--determine which labels its endpoints are closest to. This will give us a mapping of streamlines which have ends in both regions A and B, A and C, C and B, and so on and so forth, for all possible pairings of labels.\n", "\n", "To begin we'll need to load up a parcellation:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | #No. | \n", "LabelName: | \n", "R | \n", "G | \n", "B | \n", "A | \n", "
|---|---|---|---|---|---|---|
| 1120 | \n", "12156 | \n", "ctx_rh_S_interm_prim-Jensen | \n", "141 | \n", "60 | \n", "20 | \n", "0 | \n", "
| 1121 | \n", "12157 | \n", "ctx_rh_S_intrapariet_and_P_trans | \n", "143 | \n", "20 | \n", "220 | \n", "0 | \n", "
| 1122 | \n", "12158 | \n", "ctx_rh_S_oc_middle_and_Lunatus | \n", "101 | \n", "60 | \n", "220 | \n", "0 | \n", "
| 1123 | \n", "12159 | \n", "ctx_rh_S_oc_sup_and_transversal | \n", "21 | \n", "20 | \n", "140 | \n", "0 | \n", "
| 1124 | \n", "12160 | \n", "ctx_rh_S_occipital_ant | \n", "61 | \n", "20 | \n", "180 | \n", "0 | \n", "
| 1125 | \n", "12161 | \n", "ctx_rh_S_oc-temp_lat | \n", "221 | \n", "140 | \n", "20 | \n", "0 | \n", "
| 1126 | \n", "12162 | \n", "ctx_rh_S_oc-temp_med_and_Lingual | \n", "141 | \n", "100 | \n", "220 | \n", "0 | \n", "
| 1127 | \n", "12163 | \n", "ctx_rh_S_orbital_lateral | \n", "221 | \n", "100 | \n", "20 | \n", "0 | \n", "
| 1128 | \n", "12164 | \n", "ctx_rh_S_orbital_med-olfact | \n", "181 | \n", "200 | \n", "20 | \n", "0 | \n", "
| 1129 | \n", "12165 | \n", "ctx_rh_S_orbital-H_Shaped | \n", "101 | \n", "20 | \n", "20 | \n", "0 | \n", "
| 1130 | \n", "12166 | \n", "ctx_rh_S_parieto_occipital | \n", "101 | \n", "100 | \n", "180 | \n", "0 | \n", "
| 1131 | \n", "12167 | \n", "ctx_rh_S_pericallosal | \n", "181 | \n", "220 | \n", "20 | \n", "0 | \n", "
| 1132 | \n", "12168 | \n", "ctx_rh_S_postcentral | \n", "21 | \n", "140 | \n", "200 | \n", "0 | \n", "
| 1133 | \n", "12169 | \n", "ctx_rh_S_precentral-inf-part | \n", "21 | \n", "20 | \n", "240 | \n", "0 | \n", "
| 1134 | \n", "12170 | \n", "ctx_rh_S_precentral-sup-part | \n", "21 | \n", "20 | \n", "200 | \n", "0 | \n", "
| 1135 | \n", "12171 | \n", "ctx_rh_S_suborbital | \n", "21 | \n", "20 | \n", "60 | \n", "0 | \n", "
| 1136 | \n", "12172 | \n", "ctx_rh_S_subparietal | \n", "101 | \n", "60 | \n", "60 | \n", "0 | \n", "
| 1137 | \n", "12173 | \n", "ctx_rh_S_temporal_inf | \n", "21 | \n", "180 | \n", "180 | \n", "0 | \n", "
| 1138 | \n", "12174 | \n", "ctx_rh_S_temporal_sup | \n", "223 | \n", "220 | \n", "60 | \n", "0 | \n", "
| 1139 | \n", "12175 | \n", "ctx_rh_S_temporal_transverse | \n", "221 | \n", "60 | \n", "60 | \n", "0 | \n", "