In the last article I introduced Extended Streamline Tractography (XST). In this article I will talk talk about the best practices and supporting softwares when applying XST to real MR data.

## The Pipline

1. Preprocess DWI images
2. Generate seeding coordinates from ROI mask
3. Running XST
4. Embedd diffusivity metrics onto the tractography model

### Requirements

The following are required to run the supporting scripts:

#### PyNRRD:

git clone https://github.com/sinkpoint/pynrrd.git
python setup.py install


#### Scripts:

git clone https://github.com/sinkpoint/neuro-scripts.git


Then make sure to add the neuro-script repo dir to the path in .bashrc. If you are on OSX then add it to .bash_profile.

export path=PATH:/my/neuro-script  ### Preprocess DWI images Diffusion weighted image (DWI) preprocessing involves a number of steps, including motion and eddy-current corrections, possibly reverse-phase encoding corrections, resampling, etc, that are outside the scope of this article. Here I’ll outline the XST specific steps. For for information on general DWI preprocessing, refer to the FSL EDDY and TOPUP documentations. # Intro to Extended Streamline Tractography neuro | Created 2015-06-17 00:00:00 -0400 Diffusion tensor imaging (DTI) has become a mainstay in today’s neuroimaging research toolbox. It is essential for in vivo study of white matter pathways in structural neuroimaging. It is however hampered by its inability to resolve crossing fibers within key brain regions. This limitation is due to the DTI gaussian diffusion model, where regions of low anisotropy and cross-fiber regions are indistinguishable due to their gaussian diffusion profile. A number of approaches has appeared over the years to better image crossing regions. Most of these approaches are based on diffusion acquistions of more than 50 directions, and therefore belongs to the category of high angular resolution diffusion imaging (HARDI). Newer approaches tend to fall into model-free or model-based methods. Where model-free methods attempts to estimate a number of direction maximums directly from the diffusion signal, while model-based methods attempts to estimate a set number (generally less than 3) of fiber directions by simplifying the underlying diffusion assumptions. Due to the fact that these methods are all trying to estimate multiple fiber directions, sometimes they are called multi-tensor methods, although the term is not exacly correct, as a number of these methods do not estimate tensors at all. Due to the higher complexity of model-free methods, they are sensitive to acquisition quality. Often times they rely on a different sampling scheme in q-space, such as cartesian grid sampling in diffusion spectral imaging (DSI), or more popularly radial sampling on single or multiple concentric spherical shells such as in Q-ball and Constrined Spherical Deconvolution (CSD). # Where to start with Asiatic archery martial | Created 2013-10-17 00:00:00 -0400 I originally wrote this as a series of facebook messages for a friend asking for advice. It turned out to be longer than I expected, and hence it is preserved for anyone who is interested in starting Asiatic archery. The first thing you wanna know is what style of archery you want to practice. Depending on the style, the equipment will differ. You may already know this, there are essentially 3 big styles. Olympic style shooting, traditional Mediterranean, or traditional Asiatic. I don’t shoot Olympic, so I’m not gonna talk about that. Traditional Mediterranean is just known as “traditional” in North america. It’s essentially shooting of a wooden bow with the Mediterranean release (3 finger). I personally practice Chinese archery, so I practice the thumb release with a thumb ring. However Chinese, Mongolian, Korean and Turkish archery are essentially the same thing. Depending on your release style, your draw distance will differ. Generally the Mediterranean release is about 28-29″, and the asiatic styles are about 31-32″ or longer. It’s important to take that into consideration when buying a bow. Also the type of bow will differ. Because I shoot Asiatic style, I prefer bare bows, or bows with no arrow shelf built in. Bows like that are generally called “horse bows” in stores. Of course it’s not the preferred terminology. Most bows sold in stores will come with arrow shelves, you need to know the bow is “right” or “left” handed if it does. The handed means the hand you pull the string with. They are build for the Mediterranean style in mind, so the “right” handed bow will have the shelf on the left side, and vice versa. You will also need to get arrows to go with your bow. # Chinese archery 101 martial | Created 2013-10-17 00:00:00 -0400 # On Qing Ping Jian martial | Created 2011-12-08 00:00:00 -0500 Qing Ping Jian (青萍剑) is a set of famous sword forms in Chinese martial arts. Unlike other sword forms that are named after intimidating imagery or Daoist principals, it’s name is simply translated as “Green lemnoideae” sword. Like its name suggests, the characteristics of the form is known to be light on its feet, and the techniques are focused mostly on the manipulation of the sword by the wrist. It’s known to share its origin with Kun Wu Jian (昆吾剑). As far as I understand it, the Qing Ping system seems to specialize in the usage of lighter swords that can be freely used in light jabs, and can be manipulated easily by only the wrist. There are a lot of jumping and body angle changes in the air, something that can’t be done easily with heavier weapons. The Kun Wu system seems to be focused primarily on heavy swords. It focuses primarily on power generation and body alignment with stable movements. It’s name is also a throw back to a more ancient times (Kun Wu was the name of a bronze sword in Xia dynasty). Both forms are to have taken their names from actual physical swords in history. The earliest recorded reference to the name “Qing Ping” was in The Source of Phrases by Chen Ling in eastern Han dynasty, where it was written “Gentile noble is of towering material, similar to Qing Ping, Gan Jiang (another famous ancient sword) in application.” ( 辞源，陈琳文；君侯体高俗之材。秉青萍干将之器) The forms are said to have been created by Yuan Gui of title Daoist Pan (元圭，潘真人). The original forms contain 360 named movements divided amongst 6 forms. The lineage is rather complicated, and there are now 3 major known branches of Qing Ping Jian. Jia, Yang and Yuan style. (贾，杨，袁) The sword style gained major fame and publication during the Republican period following advocation by the National Guo Shu Institute (GSI; 中央国术馆) in 1920s. The GSI taught the Jia style, as a result Jia is now the most well known and most practiced style that can be found in China mainland and Taiwan. # Pagination, deep sort, and HABTM dev | Created 2011-02-25 17:04:00 -0500 Here’s a problem that had me scratching my head for hours. Creating views with HABTM relationships should be a bread-and-butter task in any web application. So you’d think Cakephp has made the workflow as intuitive as possible, but what a headache. The standard method of HABTM queries in the documentation seems intuitive enough at first glance. And this is the approach I’ve used for a while. this->Recipe->bindModel(array('hasOne' => array('RecipesTag')));
$this->Recipe->find('all', array( 'fields' => array('Recipe.*'), 'conditions'=>array('RecipesTag.tag_id'=>124) // id of Dessert ));  That is until I needed to be able to sort the resulting table by the deeper associations with pagination. In which case something like: $paginator->sort('Condition','Disorder.condition_id');


Where Disorder is a deep associated table two levels down, is going to return the error that the column Disorder.condition cannot be found.

The problem is that the table disorders is not part of FROM in the statement generated by Cakephp. Forcing a $Model->recursive = 2 does nothing. The standard solution is elusive enough that a search on Stackoverflow shows people repeating the same incorrect recommendations over and over again. The most elegant solution would’ve been to use Containable, but its “conditions” filter returns tuplets with empty results. Apperantly it’s a deliberate design decision. We are supposed to filter out the empty tuplets ourselves. This is all fine and dandy, except that will cause problem with the pagination page counter! The recommendation is to use on-the-fly associations. But honestly, why should I relearn a completely different set of of abstraction just to do something I can do so much faster with regular SQL queries? The solution I came up with is to manually state my own joins. Not very flashy, but it gets the job done, and $paginator->sort() works the way one would expect.