Poblems With BRAINS

-Clips from the developer mailing list between Denis Brown and Eugene Zeien-
Shirley Hill:
We continue to have problems with running BRAINS2 in a Linux Enterprise
system, especially on one of our workstations. I bought two Dell
workstations with Linux Enterprise WS installed about 1 year ago. From the
very beginning, we noticed BRAINS2 ran more slowly on this version of Linux
- Keshavan's lab here has been running Linux version 9 on older machines
with greater speed.

My question: because the Linux Version 9 is no longer available and we are
stuck with Enterprise what might my solution be to this problem. I could
remove the Linux altogether and reinstall a new system but if Enterprise
does not interact well with BRAINS2, I am not sure if this will help.

Denis Brown:
I see some notes relating to nVidia performance and even some in the Gentoo wiki . It may be that our config is non optimal, too, so I'll check things like fastwrites and sideband addressing. So what you're saying is that the GUI is tailored at the moment for vesa-style API and is unaware of anything else? The SGI version must have either been something unique to SGI, or they use a vesa-style api. Performance on SGI is way above my Intel friend at the moment (sad)

Eugene Zeien:
There are known performance issues with the "nvidia" video
driver. In most cases, we have reverted to using the "nv"
or even the "vesa" driver to get better display speeds.
We are painfully aware that this is a poor solution, and
we hope to re-invent the GUI to take advantage of the optimized
display drivers.

By now you may have tried the alternate
video drivers and this is no longer relevant. In general, we have
seen 5-10x improvement in display refresh speeds under linux by
reconfiguring to use "nv". BRAINS2 was originally developed on the
SGI platform. The switch from SG-only "gl" to OpenGL was motivated
by SG's decision to discontinue support for GL. Throughout BRAINS
history, more energy has been invested in optimizing the compute
backend. The problems with nvidia are relatively new, < 2 years.
We had hoped that the next revision(s) of the nvidia drivers would
resolve some issues. Instead, the situation worsens.

Vincent Magnotta:
I will provide you with the information that I have. The Psychiatry imaging lab
currently uses almost exclusively RedHat EL 3 and 4 running on DELL
machines. Therefore, I do not think that the problem is necessarily with
the version of Linux.

I know of one other site that has reported very slow refresh rates when
displaying the images. They were using RedHat as well. This may be still
be an problem for them. BRAINS2 really does not use any really fancy
rendering and simply uses pretty standard OpenGL calls. I have been
under the impression that this may actually be a problem with what
drivers were used for the video card. This is simply a guess since I
have not had the problem myself. One piece of information that may help
diagnose the problem is what video card are you using and the video
drivers being used.

Hans Johnson:

We have moved our machines to use the generic "vesa" driver because the nv drivers continue to be optimized for speed of common rendering actions found in games. This optimization seems to be at the expense of the rendering actions that BRAINS needs to display images. Using the "nv" driver works if it is old enough. Newer version of the nv driver have also introduced this problem.

Greg Harris: In testing the March 8, 2006 release of brains2 for MacOSX 10.4,
our tester encountered some trouble when editing a trace: it was apparently
impossible to select the desired contour trace loop for editing. In fact,
we found there was a reliable way to do this, by clicking the mouse THREE times.
This is due to the various subsystems on the Mac - The Finder, The X11 Emulator,
and the X-forms library used in the Brains2 GUI all needing to be individually
selected window-wise to get in a mode to receive a click and pass it on in.
Although we anticipate replacing xforms with fltk in a future version, users
of the Mac will need to make a habit of clicking through all the layers of
system interface discipline in play when running any multi-window X11 cross-platform

Brains2 Useful Scripts


 to be used via   &nbsp;&nbsp; brains2 -b scriptname

Abreviated Standard Workup Tutorial

Step-by-step Procedure guide to standard work-up in BRAINS:

a tape read onto IPL system
b rate QA of t1, t2, (pd), image(s) using WEBRATER web page.
c pick and save t1 resample parameters using BRAINS
d save aligned t1 image using BRAINS or resam script
e pick talairach parameters on ACPC aligned t1 image using BRAINS
f pick and save t2 resample parameters using BRAINS
g execute (pd)t2 to t1 fit using fit_mr2mr.tcsh script
gr submitted to run fit
h visually check (pd)t2 to t1 fit using BRAINS
hb bad fit
i manually trace r_vb, l_vb, bg, and bw traces using BRAINS
j segment and run neural_net for cran using auto_seg.sh script
jr submitted to run segmentation
k quantitatively check segmentation using kappa.sh script
l visually check segmented image using BRAINS
lb bad segmentation
m save r_vb, l_vb, bg, and bw traces using backup script
n trim non_cran rois using BRAINS
o generate cran_mask.segment, visually inspect cran_mask.segment,
determine t50 threshold using histo script, measure t50 vols,
measure standard segmented vols all using finish.sh script.
p save non_cran rois using backup script
q manually trace cerebl and hemisph surface traces using BRAINS
r generate 130 surfaces, measure surface parameters, measure zilles
parameters using surface.s script
s generate 190 surfaces, measure surface parameters, measure zilles
parameters using sisod-surf.sh script
t visually inspect 130 surfaces using BRAINS.
u visually inspect 190 surface using BRAINS.
v save hemisph and cerebl rois using backup script
w data clean and post to t50 vols dataset using SAS
data clean and post to seg vols dataset using SAS
data clean and post to surf dataset using SAS
data clean and post to 130 zilles dataset using SAS
x the pdt2 original directory images can be tossed after a good fit

Infrequently Asked Questions with noteworthy answers

Matrox Graphics Cards and the brains2 cursor

A square box under the cursor is not being redrawn correctly.
Disabling "dri" in /etc/X11/XF86Config should fix cursor redraw "bug" with brains2.

Section "Module" {panel}         Load  "dbe"         Load  "extmod"         Load  "fbdevhw"         Load  "glx" {panel} #       Load  "dri" #       Load  "record" {panel}         Load  "freetype"         Load  "type1" {panel} EndSection

Tissue Classification

PROBLEM: (from David L. Dean on 4-25-2005)

We've been working with Brains2 for about 6 months now, and we've had a good amount of success with performing the standard workup on over 200 of our scans. We're able to get whole tissue and segmented lobar volumes, and we're now looking to do more ROI tracing and the surface data. However, we wanted to ask you about a particular problem that we have with the tissue classification step.

Given that we are working with Alzheimer's and dementia patients, we have found that many of our patients have a significant amount of white matter disease, which results in the white matter being misclassified as grey matter. When I examine the standard workups that we've done, it appears that about half of the scans have a significant amount of white matter being misclassified in this way.

And so our first question is whether or not this is something that you deal with at the IPL? And if you do, how do you go about excluding or fixing those scans with a noticable amount of white matter disease?

ANSWER: (from Vincent Magnotta)
We have done some imaging in an elderly sample and have seen similar
problems on certain scans. There are really two answers to your

If the problems that you are referring to are not the result of white
matter hyperintensities (WMH) then the problem can usually be fixed by
changing the plug picking parameters. Often you can simply iterate
through the plug picking step and use the plugs as a guide to the
quality of the segmentation. If I remember correctly, we often lowered
the number of plugs required and this fixed many of the scans. These are
only general statements since I have not seen the images.

If the problems result from a large number of WMH then there is not an
immediate solution. I am looking at a sample of scans this week that
have WMH and we are investigating how these data should be handled.

If you would like to send a scan, we can look at it and provide some
more specific feedback.


PROBLEM: (This question is from Ameet R. Upadhyaya, M.D. about our surface measures)

I had a question regarding the surface data that one can obtain for generated surfaces
through the BRAINS2 software. I was wondering how valid the data is that is generated?
I have heard rumors from former attendees of the BRAINS2 workshop that the surface generation
is just for making "pretty pictures" but the data itself may be highly faulty. Any input that
either you or your colleagues can provide would be most helpful. Thanks

ANSWER:(Greg Harris provided this answer)

Our continuous tissue-classified image gives a reliable index of sub-voxel tissue composition
on a scale from 100% cerebro-spinal fluid through gray matter to 100% white matter. This image
is normalized with respect to variations among T1, T2 and PD image acquisitions, even across scanners.

The key information for finding meaningful surfaces is the construction of
parametric iso-surfaces through the tissue-classified image, which we do with GTS.
Our iso-surface through all the 100% gray matter sub-voxel positions gives us a surface
that is always anatomically well-defined as to separation of adjacent gyri, which solves
an important problem with previous thresholding methods. Working with 1 mm voxels, the
gray matter manifold surface is smooth, even "pretty"; but it is not anatomically false.

We estimate the cortical thickness at every GTS vertex in the gray matter manifold by
finding the closest point on another manifold representing 50% gray matter, 50% white matter,
and storing the thickness at the vertex as the Euclidean distance to that point. It is
important to remember that the distance from 100% gray to 50% gray represents half the
cortical thickness. Measurement of an ROI or mask thickness (or "depth") gives you the
mean and standard deviation of these numbers, weighted by the area accounted for by the
"fan" of triangles arranged around each vertex.

Although the numbers obtained do not exactly equal those obtained on post-mortem cryo-sections
by holding up a ruler to the tissue after dividing by 2, brains2 depth measures provide
an accurate index that is stable across similarly obtained MRI scans. Depth, area, and
gray matter volume measures from this brains2 workup process are meaningful scientific measures
of the cortical anatomy represented by the gray matter manifold enclosed by an ROI or mask.

As to curvature measures, we only use them to separate sulci from gyri, and as an accurate
index of tightness of curvature of sulci or gyri. We have used the standard curvature
measure of Meyer, Desbrun, Schroeder and Barr, that is used in FreeSurfer as well, but
for our purpose of measuring cortical sulci we have filtered the indentation-protrusion
indexes, which are negative for concavities and positive for convexities, to a convenient
index of the scale of human sulcal and gyral gross curvature, so as to correctly pick out
human sulci and gyri as connected regions. This, and only this, aspect may be what
deserves to be called "pretty pictures" because the single-voxel-scale variations have
been lost.

Updated brains2rc format

Copy the text below into a file, say /tmp/awkfile. Then, simply<br>
mv .brains2rc .brains2rc.old<br>
awk -f /tmp/awkfile .brains2rc.old > .brains2rc

  1. Viewer customizations
  2. Only a few of our users had customized their layout.
  3. So all the numbers are hard-coded here.
    Unknown macro: { printf("B2_EVAL_TCL_GUI "B2_VIEWERS_INITIAL_LAYOUT" "); printf(""b2 window geometry axi geometry= 472x464+290+45 ;"); printf(" b2 window geometry cor geometry= 472x464+290+525 ;"); printf(" b2 window geometry sag geometry= 472x464+800+525 ;"); printf(" b2 window geometry surf geometry= 472x464+800+45 ; "n"); next}
    $1h1. "B2_CORONAL_VIEWER"
    Unknown macro: { print "#"$0 ; next}


    $1h1. "B2_SURFACE_VIEWER"
    Unknown macro: { print "#"$0 ; next}
  4. Existing customized files match defaults
    Unknown macro: { next}

    $1h1. "B2_TRACKER_VIEWER"

  5. Database is defunct.
    Unknown macro: { print "#Deprecated#"$0 ; next}

    $1h1. "B2_DATABASE_NAME"

    Unknown macro: { print "#Deprecated#"$0 ; next}

    $1h1. "B2_DATABASE_SERVER"

  6. Simple on/off flags
    Unknown macro: {if($2=="on")
    Unknown macro: {v=1}


    Unknown macro: {v=0}

    printf("B2_EVAL_TCL \"B2_EXPERT_USER\" \"set B2_EXPERT_USER %d ; \"\n",v);\
    $1h1. "B2_IPL_FLAG"{if($2"on")

    Unknown macro: {v=0}

    printf("B2_EVAL_TCL \"B2_IPL_FLAG\" \"set B2_IPL_FLAG %d ; \"\n",v);\
    $1h1. "B2_QA_RATER"{if($2"on")

    Unknown macro: {v=1}


    ; printf("B2_EVAL_TCL "B2_QA_RATER" "set B2_QA_RATER %d ; "n",v); next}
  7. Where to dump files/data
    $1h1. "B2_GLOBAL_DATA_DIR"
    Unknown macro: { printf("B2_EVAL_TCL "%s" "set %s %s ; "n", $1,$1,$2 ); next}


  8. These are the tough ones
    Unknown macro: {MASK++; name="mask"MASK; pat=$3; opt=""; N=4; while(N<=NF)
    Unknown macro: {opt=opt" "$N;N++}

    printf("B2_EVAL_TCL \"B2_%s_MASK_DEFAULTS\" \"b2 default mask filepattern= ",name);\

    Unknown macro: { %s }

    %s\n", pat, opt);\
    $1=="B2_DEFAULT_ROI"{name=$3; opt=""; N=3; while(N<=NF)

    ; printf("B2_EVAL_TCL "B2_%s_ROI_DEFAULTS" "b2 default roi name= ", name); printf("%sn", opt); next}
    Unknown macro: {name=$2; N=3; while($N!="}
  9. New brains2rc lingo, pass thru.
    $1h1. "B2_EVAL_TCL"
    Unknown macro: { print $0 ; next}


    $1h1. "B2_TCLSCRIPT_DIR"
    Unknown macro: { print $0 ; next}
    Unknown macro: { print $0; next}
  10. Let comments thru
    Unknown macro: {print $0 ; next}
  11. default case
    Unknown macro: {print $0}
  • No labels