# PyDesigner QC

**Required Software**: FSLeyes, ImageJ

* **Visual QC**

  * **Procedure**

    * *Note*: this process can be done with another piece of software such as FSLeyes or MRIcron, but using ImageJ helps to ensure that no manipulation is done to the image (auto-smoothing, auto-reorientation, etc) via software defaults. ImageJ also offers more view customization, allowing for greater freedom to QC effectively.
    * Open ImageJ, drag and drop the file you want to QC into ImageJ in the highlighted area here:

    <figure><img src="/files/NDdnOweDDtxgPMGAbVtj" alt=""><figcaption></figcaption></figure>

    * Change options if need be:
      * *Increase size*: Click the magnifying glass on the toolbar (shown above) and right click the image until it is your preferred size (left click to decrease size)
      * *Reorient image*: The image may be upside down. If so, select ImageJ and, on the Mac toolbar, click ‘Image’. Navigate to ‘Transform’ and select ‘Flip Vertically’.
      * *Change contrast*: You can also change the contrast if need be (this may be necessary on images that have very high or low voxel values and may appear all white or all black.
        * On the top Mac toolbar, select ‘Image’, ‘Adjust’, and ‘Brightness/Contrast’. A pop-up box will appear, select ‘Auto’ and then ‘Apply’.
        * Additionally, click ‘Set’ and change the values to the standard value spread for the metric you are QCing (0-1 for FA, 0-3 for MD and MK)
      * *Change color*: To change image from greyscale to color, go to ‘Image’, all the way down to ‘Lookup Tables’ and find a color scheme that works for you (Fire is an NIH standard, but it is up to your preference).
    * Click the play button at the bottom of the image box here:

    <figure><img src="/files/HLHrd2pfW72lI5oDIDOw" alt="" width="375"><figcaption></figcaption></figure>

    * This will auto scroll through the image for you.
    * Additionally, you can create a montage/mosaic-style image if you prefer.
      * On the top Mac toolbar, click ‘Image’, then ‘Stacks’, then ‘Make Montage…’
      * A mosaic image will appear. This maybe be easier for you to QC or not, it is up to your preference.
    * Whichever viewing method you choose, look for any apparent artifacts such as distortions of WM tracts, blurriness, bands running through an image that make it appear sliced in half, etc.
  * **Standards**

    * MK maps should show higher values in WM and lower in GM/CSF. Towards the center of the brain, the ventricles and the corpus callosum + surrounding WM bundles should be especially different, like so:

      <figure><img src="/files/WCLaH0VCC1FLSQFmwxjq" alt="" width="300"><figcaption></figcaption></figure>
    * FA maps should have very apparent WM tracts that remain undistorted and clear throughout the brain

    <figure><img src="/files/qbFnAwFFuBpSrrZmNKFG" alt="" width="308"><figcaption></figcaption></figure>

    * MD will mostly highlight GM and CSF, WM tracts will not be especially apparent, ensure that ventricles and cortical GM appear to have sufficiently high values (brightness)

  <figure><img src="/files/pMwdIgTffyj0YxYaO0iJ" alt="" width="308"><figcaption></figcaption></figure>
* **Possible Problems**
  * Overall low values
    * If maps appear darker than expected, it may be that the values across the map are lower than average. This will be more apparent during the Value QC and does not warrant noting on the visual QC
  * Tensor fitting issues

    * Rarely you may see clusters of zero value (black) voxels within an area that should not contain zero value voxels, like this:

    <figure><img src="/files/27yFWgOKSbVidCoFbzZ7" alt="" width="362"><figcaption></figcaption></figure>

    * This can denote a tensor fitting issue and should be noted in your QC documentation. If this is a true tensor fitting issue, it may mean that preprocessing should be rerun or revisited in some way.
  * Artifacts of any kind

    * Artifacts, distortions, and other visual issues can be difficult to detect and subjective. Use your best judgement and err on the side of caution when reporting visual issues like this. Better to note a possible issue that has no impact on downstream processing than to not note a subtle issue only to have to track it down later when it causes downstream issues.

    <figure><img src="/files/UWWonck3o6RPPlcluyFb" alt="" width="375"><figcaption></figcaption></figure>
* **Value QC**
  * **Procedure**

    * Open FSLeyes; drag and drop the file you want to QC into FSLeyes
    * With FSLeyes selected, navigate to the top Mac toolbar, click ‘View’, and select ‘Histogram’.
    * You should see something similar to this:
    *

    ```
    <figure><img src="/files/NELUGG424cMQn3oBdXCi" alt=""><figcaption></figcaption></figure>
    ```

    * If your histogram area is smaller than you’d like it to be, you can mouse over the edges and change the size.
    * Make sure histogram type is set to count
    * Observe the spread of values on the histogram and QC to standards below.
  * **Standards**
    * MK values will have a peak in or around the \~5000-13000 range and a most values will fall between \~0.2 and \~1.5 like so:
      \*

      ```
      <figure><img src="/files/WjVzsa5OFxjhPFmHR6MQ" alt=""><figcaption></figcaption></figure>
      ```
    * FA values will have a peak in or around the \~2500-4000 range and a most values will fall between \~0 and \~0.5 like so:
      \*

      ```
      <figure><img src="/files/iAtbzrmYHM0DY4OqCVU8" alt=""><figcaption></figcaption></figure>
      ```
    * MD values will have a peak in or around the \~8000-10000 range and a most values will fall between \~0.5 and \~3.0 like so:
      \*

      ```
      <figure><img src="/files/3ORnuQ6mErgqBtSRGzaC" alt=""><figcaption></figcaption></figure>
      ```
  * **Possible Problems**
    * High value voxels:
      \*

      ```
      <figure><img src="/files/3gYMb0Ji7rZV2RKw0caF" alt=""><figcaption></figcaption></figure>
      ```

      * Plots with a very high narrow peaks with a spread of x-axis values spread out into the hundreds or thousands like this are indicative of a handful of extremely high value voxels.
        * Plots with extremely low values will look similar but may have x-axes with very low values.
        * Note the presence of high or low value voxels on the QC sheet.
      * The regular (non-high value) values still need to be QC’d though, so go to FSLeyes’s Histogram settings here:
        \*

        ```
        <figure><img src="/files/djt5p6nOqJRpNTTBJ33s" alt=""><figcaption></figcaption></figure>
        ```
      * In the settings pop-up box, change the data range on the very bottom here:
        \*

        ```
        <figure><img src="/files/t6fpvL4M9mOLJ3Ruw576" alt=""><figcaption></figcaption></figure>
        ```
      * Change the data range to the appropriate range for the metrics (0-1 for FA, 0-3 for MK and MD)
      * The histogram should change to resemble a standard curve; QC as normal.
    * Lower or higher than average ranges
      * Some maps may have curves indicating that the voxels in the map are generally lower or higher than the expected. This may or may not be an issue – it could be a preprocessing problem, the result of an artifact or other image issue, or simply a characteristic of the map. It should always be noted in QC documentation.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bridge-lab.gitbook.io/docs/imaging/image-analysis/general-concepts/image-qc/pydesigner-qc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
