External Email - Use Caution        

Hi Bruce,

Thanks for your response. I figured it out, but it took a while to
troubleshoot. There were a number of issues at play, some due to my
stupidity and some that may suggest feature improvements.

   1. The primary issue was that the FOV of the T2 images did not cover the
   entire brain volume, presumably since the primary purpose of the
   acquisition was to inspect the ventricles and/or subcortical structures.
   2. In this scenario, the current stable release appears to exit with the
   "Segmentation fault" error as described in my original message. The current
   dev version spits out the "MRIhistogramLabelRegion: constant image"
   error and then just hangs indefinitely with 100% CPU load.
   3. It may be a good idea to implement a check at the beginning of
   recon-all (if a T2 or FLAIR flag is passed) to verify if the image contains
   the entire brain volume. If it doesn't, an error message could be raised,
   so the user has an opportunity to correct their mistake.
   4. Once I realized the issue, I exported a different image sequence that
   contained the full brain volume. I then ran -autorecon3 with the new T2
   image, but the process still failed. This is where I got stuck for HOURS.
   The reason for the fault was that the transforms for the T2 image from the
   previous T2 image are retained in the mri/transforms folder. Therefore, the
   transforms of the incomplete images were applied to the complete images,
   resulting in cropping of the brain volume to the point where it was then
   incomplete again. This ultimately led to the same problem. The
   mri/orig/T2raw.mgz image was in good shape, but the mri/T2.mgz would
   already exhibit the cropping.
   5. It may be a good idea to implement a check that verifies whether the
   T2 image has changed and if the existing transforms correspond to the
   specified T2 image, possibly via a checksum that is stored in the
   T2raw.auto.* 
<http://secure-web.cisco.com/1Ca-6WOM9invcqQ6HF3AL5StykkRxAUrVlz_V5s9CLy8GOubgwdB9TcpdevemyJiWkkcR4P4Mp-7pY9cknQS2q9vslNih_ITBRt_Ax94GO74LurlNqX_EaXNWHqM30QSO_m12YU8QA1hJf7xhe_L-_oSwFYjD04a2KQ9bwzOMgXtqN15gh_JUi0QXWrrM1gQAsuT33ZOS4VhbBxiTIQZY0lA3_3JBFDKlwBFZzgzBLphzWgihSaFB7AA-5w7xLRAB4YOa3O1-m-fZtGP0ocgeQy8QkFv3v2CywRiWAtAI4OJpndqnP3iNuwfLB_fvU-mp/http%3A%2F%2Ft2raw.auto*/>
 and/or the T2raw.lta file. If it is
   determined that the input image has been updated and does not correspond to
   the transforms, the automatically generated transforms could be
   overwritten, thereby avoiding this issue. Or you could just recreate the
   automatic transforms regardless, since it seems that it would only be
   useful to retain transforms if they contain manual or external registration
   data.
   6. If access to my images or logs would be helpful to you in the
   (potential) implementation of these suggestions, please let me know and I
   can upload them. I retained a copy of one of the problematic folders.

There were a few issues I (may or may not have) encountered along the way.
Unfortunately, I didn't keep detailed enough notes throughout my
troubleshooting process and don't have the (compute) time to recreate these
potential problem areas. It may be a good idea to verify if the following
items cause problems:

   1. I originally called recon-all with the -T2 flag, but did not include
   -T2pial. I don't recall if this created an issue or if the -T2pial flag is
   implied when passing a T2 image. Presumably, this behavior would be
   analogous for FLAIR images.
   2. I worked with the -parallel -openmp N flag for a while and then
   suspected that this may have been part of the problem. I believe to
   remember that when using the -parallel flag, all of my T2 processing
   failed, while only the ones with incomplete image volumes failed when not
   using the -parallel flag.
   3. I have one image series with 512 x 512 x 170 px dimensions and a FOV
   of 260 degrees. FreeSurfer is not happy about that. I tried to use -hires
   and -cw256 (which appear to be mutually exclusive). I eventually ended up
   simply cropping it with MRIcroGL. It would be nice to have an automatic
   feature in FreeSurfer that crops excessive FOVs, so that this glitch
   doesn't occur and this manual step wouldn't be necessary. It would also be
   helpful to have the option in mri_convert to specify both the crop size and
   the center of a crop. Currently, these options appear to be mutually
   exclusive.
   4. Most of my T1 images are 256 x 256 px in size, but the T2 images are
   all higher resolution, either 384 x 384 or 512 x 512, but with a very large
   slice thickness of more than 4 mm. I don't know if it's possible and how
   it's currently implemented, but it would be nice to be able to process the
   T1 images in their original resolution to save on compute time, but then
   interpolate and refine with the higher resolution T2 images during the
   -autorecon3 processes. It seems that this would combine the best of both
   worlds.

I hope this feedback is helpful.

Best,
Thomas


*Thomas Kaufmann*, Dipl.-Phys., M.S.
Pronouns: he/him/his
Physicist | Audio Engineer | Disability Rights Activist


*Arizona State University | College of Health Solutions*
Speech and Hearing Science (Auditory & Language Neuroscience)
975 S Myrtle Ave, Tempe, AZ 85281 | Lattie F. Coor Hall



Date: Wed, 9 Oct 2024 17:42:22 +0000
From: "Fischl, Bruce R.,PHD" <bfis...@mgh.harvard.edu> Subject: Re:
[Freesurfer] Error During T2/FLAIR Pial Surface Refinement
To: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu> Message-ID:
<
dm5pr04mb126171d02f1f51dffe60c096ef...@dm5pr04mb1261.namprd04.prod.outlook.com
>


Content-Type: text/plain; charset="utf-8"


Hi Thomas


Can you check the input images? I've seen this happen when e.g. the skull
stripping failed and the images are blank



Cheers
Bruce




On Wed, Oct 09, 2024 at 10:37 AM, Thomas Kaufmann <tkaufm...@asu.edu> wrote:

> Hello FreeSurfer Developers,
>
> I'm attempting to refine pial surfaces with T2/FLAIR images as described
> here 
> (https://secure-web.cisco.com/1R4-8moFvOommy8UNXErfhOkkD_Bz4_9X2aJQpzXbNo9DgwIxW72SE9SZDo-enRjOr8lfrqJ0oEn4tFNNxKDbVQkYrF8sKH7h7tFMe_pyGmZHCwkUMcVXEWaGM8MmnSqATunbf6rffh63-56BO5FpFp-MjZwxd7pExvROAiE_jVNOePQQcqdjzr1KPoJLoEVG7lNLYHXgn8IpRGILsnAUcJ7OFvyBq7hpbL7ASPmPTJ6jtECsa-9AgAvzObWWqqAAojsjw4mJT0twQY3T-ze2sMQWjWO0L8U0AfZncf0SbRGjXFOzTzEz90YXQafGoyQfZ68KwX7vVuvawERMT-n_nQ/https%3A%2F%2Fsurfer.nmr.mgh.harvard.edu%2Ffswiki%2F
> recon-all#UsingT2orFLAIRdatatoimprovepialsurfaces). For some of my
> subjects I get the following error during the mris_place_surface subprocess
> when I run recon-all:
>
>     error: MRIhistogramLabelRegion: constant image
>
>     error: MRIhistogramLabelRegion: constant image
>
>     Segmentation fault
>
> The error occurs independent of whether I process T1 and T2 images
> together with -all or if I run only -autorecon3 with the T2 or FLAIR images
> added.
>
> I've searched the list and while similar errors have been reported, no
> solutions have been proposed. Does anyone have any thoughts on how to
> troubleshoot this one?
>
> 1) FreeSurfer version:
> freesurfer-macOS-darwin_x86_64-7.4.1-20230614-7eb8460
> 2) Platform: macOS Sonoma 14.6.1
> 3) uname -a: Darwin MacBook-Air-M3 23.6.0 Darwin Kernel Version 23.6.0: Mon
> Jul 29 21:14:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8122 arm64
> 4) recon-all.log: relevant section below
>
> Thank you!
> Thomas
>
>
> mris_place_surface --adgws-in ../surf/autodet.gw.stats.lh.dat --seg
> aseg.presurf.mgz --wm wm.mgz --threads 8 --invol brain.finalsurfs.mgz --lh
> --i ../surf/lh.pial.T1 --o ../surf/lh.pial.T2 --pial --nsmooth 0
> --rip-label ../label/lh.cortex+hipamyg.label --pin-medial-wall
> ../label/lh.cortex.label --white-surf ../surf/lh.white --aparc
> ../label/lh.aparc.annot --repulse-surf ../surf/lh.white --mmvol T2.mgz T2
>
>
> Reading in input surface ../surf/lh.pial.T1
>
> Not smoothing input surface
>
> Area    280714  0.42434  0.32508 0.000178   6.1090
>
> Corner  842142 60.00000 30.99319 0.049953 179.7466
>
> Edge    421071  1.04711  0.48130 0.006015   7.4374
>
> Hinge   421071 18.87838 25.11022 0.000011 179.9979
>
> Reading white surface coordinates from ../surf/lh.white
>
> Reading repulsion surface coordinates from ../surf/lh.white
>
> Reading in aparc ../label/lh.aparc.annot
>
> [DEBUG] CTABreadFromBinaryV2(): ct->nentries=36, num_entries_to_read=36
>
> Reading in input volume brain.finalsurfs.mgz
>
> Reading in seg volume aseg.presurf.mgz
>
> Reading in wm volume wm.mgz
>
> MRIclipBrightWM(): nthresh=15378, wmmin=5, clip=110
>
> MRIfindBrightNonWM(): 1814 bright non-wm voxels segmented.
>
> Masking bright non-wm for pial surface mid_gray = 67.5589
>
> MRImask(): AllowDiffGeom = 1
>
> MRImask(): AllowDiffGeom = 1
>
> MRImask(): AllowDiffGeom = 1
>
> Ripping frozen voxels
>
> Ripping vertices not in label ../label/lh.cortex+hipamyg.label
>
> MRISripNotLabel() ripped 6543/140359 vertices (133816 unripped)
>
> INFO: rip surface needed but not specified, so using input surface
>
> Ripping segs (eg, WMSA, BG, frozen)
>
> Starting MRISripSegs() d = (-2 2 0.5) segnos: 247
>
> MRISripSegs(): -2 2 0.5 ripped 0
>
> Reading in multimodal volume T2.mgz
>
>  using multi modal weights
>
> vertex 70180: xyz = (-39.3637,-26.8713,28.9107) oxyz =
> (-42.1603,-27.2597,31.4024) wxzy = (-42.1603,-27.2597,31.4024) pxyz =
> (-39.3637,-26.8713,28.9107)
>
> CBVO Creating mask 140359
>
> n_averages 4
>
> Iteration 0 =========================================
>
> n_averages=4, current_sigma=2
>
> Computing pial target locations using multimodal (1)
>
> starting MRIScomputePialTargetLocationsMultiModal()
>
> max_outward_dist = 3, sample_dist = 0.1, pix_size = 1, whalf = 7
>
> T2_min_inside = 110, T2_max_inside 300, T2_min_outside = 130,
> T2_max_outside 300
>
> inside_peak_pct = 0.1, 0.01, outside_peak_pct = 0.5, 0.5
>
> wm_weight = 3, nlabels=0, contrast_type=1
>
> Changed 198177 aseg cortex voxels to 0
>
> Creating lowres distance volumes t=0.0164299
>
> Creating white distance volumes t=0.307498
>
> (box.dx, box.dy, box.dz) = (132, 242, 326)
>
> (region->dx, region->dy, region->dz) = (132, 242, 326)
>
> (region->dx, region->dy, region->dz) = (132, 242, 326)
>
> Creating pial distance volumes t=0.609579
>
> (box.dx, box.dy, box.dz) = (144, 256, 336)
>
> (region->dx, region->dy, region->dz) = (144, 256, 336)
>
> (region->dx, region->dy, region->dz) = (144, 256, 336)
>
> locating cortical regions not in interior range [110.0 --> 300.0], and not
> in exterior range [130.0 --> 300.0]
>
> t = 0.984043
>
> Starting loop over 140359 vertices
>
>    vno = 0, t = 0.984043
>
> error: MRIhistogramLabelRegion: constant image
>
> error: MRIhistogramLabelRegion: constant image
>
> Segmentation fault
>
>
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is 
addressed.  If you believe this e-mail was sent to you in error and the e-mail 
contains patient information, please contact the Mass General Brigham 
Compliance HelpLine at https://www.massgeneralbrigham.org/complianceline 
<https://www.massgeneralbrigham.org/complianceline> .
Please note that this e-mail is not secure (encrypted).  If you do not wish to 
continue communication over unencrypted e-mail, please notify the sender of 
this message immediately.  Continuing to send or respond to e-mail after 
receiving this message means you understand and accept this risk and wish to 
continue to communicate over unencrypted e-mail. 

Reply via email to