Skip to content

Commit

Permalink
gcc 8.4 updates (freesurfer#843)
Browse files Browse the repository at this point in the history
  • Loading branch information
ltirrell authored Feb 5, 2021
1 parent 290fa49 commit 07a667a
Show file tree
Hide file tree
Showing 40 changed files with 580 additions and 153 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CTestTestfile.cmake
Makefile
*.[oa]
ld_map.txt
install_manifest.txt

# generated help files
*.help.xml.h
Expand Down Expand Up @@ -49,6 +50,8 @@ anatomicuts/AnatomiCuts.bin
anatomicuts/AnatomiCuts_correspondences.bin
anatomicuts/streamlineFilter.bin
anatomicuts/trk_tools.bin
AntsDenoiseImageFs/AntsDenoiseImageFs
AntsN4BiasFieldCorrectionFs/AntsN4BiasFieldCorrectionFs
check_siemens_dir/check_siemens_dir
connectgraph/connectgraph
diffusion_tool/diffusion_tool
Expand Down Expand Up @@ -82,6 +85,7 @@ mri_and/mri_or
mri_annotation2label/mri_annotation2label
mri_aparc2aseg/mri_aparc2aseg
mri_aparc2wmseg/mri_aparc2wmseg
mri_aparc2aseg/mri_surf2volseg
mri_apply_inu_correction/mri_apply_inu_correction
mri_aseg_edit_reclassify/mri_aseg_edit_reclassify
mri_aseg_edit_train/mri_aseg_edit_train
Expand All @@ -91,6 +95,7 @@ mri_bc_sc_bias_correct/mri_bc_sc_bias_correct
mri_bias/mri_apply_bias
mri_bias/mri_compute_bias
mri_binarize/mri_binarize
mri_brainvol_stats/mri_brainvol_stats
mri_build_priors/mri_build_priors
mri_ca_label/mri_ca_label
mri_ca_normalize/mri_ca_normalize
Expand Down Expand Up @@ -217,6 +222,7 @@ mri_polv/mri_polv
mri_probe_ima/mri_probe_ima
mri_probedicom/mri_probedicom
mri_reduce/mri_reduce
mri_refine_seg/mri_refine_seg
mri_register/mri_register
mri_relabel_hypointensities/mri_relabel_hypointensities
mri_relabel_nonwm_hypos/mri_relabel_nonwm_hypos
Expand All @@ -234,6 +240,7 @@ mri_robust_register/mri_robust_register
mri_robust_register/mri_robust_template
mri_sbbr/mri_sbbr
mri_seg_diff/mri_seg_diff
mri_seg_overlap/mri_seg_overlap
mri_segcentroids/mri_segcentroids
mri_seghead/mri_seghead
mri_segment/mri_segment
Expand Down Expand Up @@ -270,6 +277,7 @@ mri_volsynth/mri_volsynth
mri_warp_concat/mri_warp_concat
mri_warp_convert/mri_warp_convert
mri_watershed/brain_volume/mri_brain_volume
mri_watershed/brain_volume/mri_brain_volume_test
mri_watershed/mri_validate_skull_stripped
mri_watershed/mri_watershed
mri_wbc/mri_wbc
Expand All @@ -281,6 +289,7 @@ mris2rgb/mris2rgb
mris_BA_segment/mris_BA_segment
mris_add_template/mris_add_template
mris_anatomical_stats/mris_anatomical_stats
mris_annot_diff/mris_annot_diff
mris_annot_to_segmentation/mris_annot_to_segmentation
mris_apply_reg/mris_apply_reg
mris_aseg_distance/mris_aseg_distance
Expand Down Expand Up @@ -340,9 +349,11 @@ mris_longitudinal_surfaces/mris_longitudinal_surfaces
mris_make_average_surface/mris_make_average_surface
mris_make_face_parcellation/mris_make_face_parcellation
mris_make_map_surfaces/mris_make_map_surfaces
mris_make_surfaces/mris_autodet_gwstats
mris_make_surfaces/mris_exvivo_surfaces
mris_make_surfaces/mris_make_surfaces
mris_make_surfaces/mris_mef_surfaces
mris_make_surfaces/mris_place_surface
mris_make_surfaces/mris_refine_surfaces
mris_make_template/mris_make_template
mris_map_cuts/mris_map_cuts
Expand Down Expand Up @@ -452,3 +463,7 @@ utils/fsPrintHelp
utils/gifti_test
utils/gifti_tool
utils/xmlToHtml

# testdata
*/testdata
Testing
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ if(NOT APPLE)
NAMES libgfortran.a gfortran)
find_library(BLAS_LIBRARIES NAMES libopenblas.a libblas.a)
find_library(LAPACK_LIBRARIES NAMES liblapack.a)
find_library(QUADMATH_LIBRARIES
HINTS /usr/lib64 /usr/lib /usr/lib/gcc/*/*/
NAMES libquadmath.a)
endif()

# -------- armadillo --------
Expand Down
7 changes: 7 additions & 0 deletions attic/mri_cal_normalize/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
project(mri_cal_normalize)

include_directories(${FS_INCLUDE_DIRS})

add_executable(mri_cal_normalize mri_cal_normalize.cpp)
target_link_libraries(mri_cal_normalize utils)
install(TARGETS mri_cal_normalize DESTINATION bin)
File renamed without changes.
4 changes: 0 additions & 4 deletions mri_ca_normalize/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ target_link_libraries(mri_ca_normalize utils)
install(TARGETS mri_ca_normalize DESTINATION bin)

add_test_script(NAME mri_ca_normalize_test SCRIPT test.sh DEPENDS mri_ca_normalize)

add_executable(mri_cal_normalize mri_cal_normalize.cpp)
target_link_libraries(mri_cal_normalize utils)
install(TARGETS mri_cal_normalize DESTINATION bin)
10 changes: 8 additions & 2 deletions mri_ca_normalize/mri_ca_normalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1341,10 +1341,16 @@ find_control_points

if (mri_ctrl)
{
sprintf(fname, "%s_init_label%d.labels.mgz", fname_only, label) ;
int req = snprintf(fname, STRLEN, "%s_init_label%d.labels.mgz", fname_only, label) ;
if (req >= STRLEN) {
std::cerr << __FUNCTION__ << ": Truncation on line " << __LINE__ << std::endl;
}
printf("writing initial sample points for %s to %s\n", cma_label_to_name(label), fname);
MRIwriteFrame(mri_ctrl, fname, 0) ;
sprintf(fname, "%s_init_label%d.priors.mgz", fname_only, label) ;
req = snprintf(fname, STRLEN, "%s_init_label%d.priors.mgz", fname_only, label) ;
if (req >= STRLEN) {
std::cerr << __FUNCTION__ << ": Truncation on line " << __LINE__ << std::endl;
}
printf("writing initial label priors for %s to %s\n", cma_label_to_name(label), fname);
MRIwriteFrame(mri_ctrl, fname, 1) ;
MRIfree(&mri_ctrl) ;
Expand Down
5 changes: 4 additions & 1 deletion mri_coreg/mri_coreg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1826,7 +1826,10 @@ MRI *MRIconformNoScale(MRI *mri, MRI *mric)
// Map input to geometry template
mric = MRIresample(mri, mritmp, SAMPLE_NEAREST);

sprintf(mric->fname,"%s/Conformed",mri->fname);
int req = snprintf(mric->fname,STRLEN,"%s/Conformed",mri->fname);
if (req >= STRLEN) {
std::cerr << __FUNCTION__ << ": Truncation on line " << __LINE__ << std::endl;
}
MRIfree(&mritmp);

return(mric);
Expand Down
18 changes: 18 additions & 0 deletions mri_edit_segmentation/mri_edit_segmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ edit_hippocampus(MRI *mri_in_labeled, MRI *mri_T1, MRI *mri_out_labeled) {
switch (label) {
case Left_Cerebral_White_Matter:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Cerebral_White_Matter:
dgray = distance_to_label(mri_out_labeled,
left ? Left_Cerebral_Cortex :
Expand All @@ -271,8 +274,14 @@ edit_hippocampus(MRI *mri_in_labeled, MRI *mri_T1, MRI *mri_out_labeled) {
left ? Left_Cerebral_Cortex : Right_Cerebral_Cortex,
left ? Left_Cerebral_White_Matter : Right_Cerebral_White_Matter) ;
}
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Left_Hippocampus:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Hippocampus:
dgray = distance_to_label(mri_out_labeled,
left ? Left_Cerebral_Cortex :
Expand Down Expand Up @@ -349,6 +358,9 @@ edit_hippocampus(MRI *mri_in_labeled, MRI *mri_T1, MRI *mri_out_labeled) {
}
case Left_Cerebral_Cortex:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Cerebral_Cortex:
dup = distance_to_label(mri_out_labeled,
left ? Left_Hippocampus :
Expand Down Expand Up @@ -604,6 +616,9 @@ edit_amygdala(MRI *mri_in_labeled, MRI *mri_T1, MRI *mri_out_labeled) {
switch (label) {
case Left_Cerebral_Cortex:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Cerebral_Cortex:
dup = distance_to_label(mri_out_labeled,
left ? Left_Amygdala :
Expand Down Expand Up @@ -882,6 +897,9 @@ edit_lateral_ventricles(MRI *mri_in_labeled, MRI *mri_T1, MRI *mri_out_labeled)
switch (label) {
case Left_Inf_Lat_Vent:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Inf_Lat_Vent:
dwhite = distance_to_label(mri_out_labeled,
left ? Left_Cerebral_White_Matter :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,9 @@ relabel_hypointensities(MRI *mri, MRI *mri_inputs,
*/
break ;
}
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Left_WM_hypointensities:
case Right_WM_hypointensities: // check to see if it's outside ribbon and change it to gm
if (gca) // if we have a gca, check to make sure gm is possible here
Expand Down
36 changes: 36 additions & 0 deletions mri_edit_wm_with_aseg/mri_edit_wm_with_aseg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)
break ;
}

#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
/* !!! no break - erase unknown if it is surrounded by only unknowns */

/* erase these labels */
Expand Down Expand Up @@ -373,6 +376,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)
case Right_non_WM_hypointensities:
if (fcd)
break ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Left_Lesion:
case Right_Lesion:
case WM_hypointensities:
Expand Down Expand Up @@ -440,6 +446,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)
MRIvox(mri_filled, x, y, z) = AUTO_FILL ;
non++ ;
}
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Left_Inf_Lat_Vent:
case Right_Inf_Lat_Vent:
xi = (label == Left_Inf_Lat_Vent) ? mri_wm->xi[x+1] : mri_wm->xi[x-1] ; // lateral
Expand Down Expand Up @@ -588,6 +597,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)
break ;
case Left_Hippocampus:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Hippocampus:
{
int xi ;
Expand Down Expand Up @@ -783,6 +795,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)

case Left_Lateral_Ventricle:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Lateral_Ventricle:
olabel = left ? Left_Cerebral_White_Matter : Right_Cerebral_White_Matter ;
if (neighborLabel(mri_seg, x, y, z, 2, olabel) > 0)
Expand Down Expand Up @@ -879,6 +894,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)
{
case Left_Cerebral_Cortex:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Cerebral_Cortex:
case Unknown:
// look for voxels that are lateral to amygdala, and inf to wm. Should be filled
Expand Down Expand Up @@ -1025,6 +1043,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)
case Left_Hippocampus:
case Left_Amygdala:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Inf_Lat_Vent:
case Right_Hippocampus:
case Right_Amygdala:
Expand Down Expand Up @@ -1230,6 +1251,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)
{
case Left_Cerebral_Cortex:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Cerebral_Cortex:
if (MRIvox(mri_wm, x, y, z) >= MIN_WM_VAL)
{
Expand Down Expand Up @@ -1449,6 +1473,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)
{
case Left_Cerebral_Cortex:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Cerebral_Cortex:
// make sure we aren't on the medial edge of hippo
#if 0
Expand Down Expand Up @@ -1526,6 +1553,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)
{
case Left_Cerebral_Cortex:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Cerebral_Cortex:
// make sure we aren't on the medial edge of hippo
#if 0
Expand Down Expand Up @@ -1815,6 +1845,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)
{
case Left_Cerebral_White_Matter:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Cerebral_White_Matter:
hlabel = left ? Left_Hippocampus : Right_Hippocampus ;
// if there is any hippo superior to this label, turn it on
Expand Down Expand Up @@ -1863,6 +1896,9 @@ edit_segmentation(MRI *mri_wm, MRI *mri_T1, MRI *mri_seg)
case Left_Hippocampus:
case Left_Amygdala:
left = 1 ;
#if __GNUC__ >= 8
[[gnu::fallthrough]];
#endif
case Right_Hippocampus:
case Right_Amygdala:
case Right_Inf_Lat_Vent:
Expand Down
11 changes: 8 additions & 3 deletions mri_fill/mri_fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3186,8 +3186,10 @@ main(int argc, char *argv[])
"%s: could not read SUBJECTS_DIR from environment",Progname) ;
strcpy(subjects_dir, cp) ;

sprintf(fname, "%s/%s/mri/transforms/%s.m3d", subjects_dir,sname,
atlas_name) ;
int req = snprintf(fname, STRLEN, "%s/%s/mri/transforms/%s.m3d", subjects_dir,sname, atlas_name);
if (req >= STRLEN) {
std::cerr << __FUNCTION__ << ": Truncation on line " << __LINE__ << std::endl;
}
m3d = MRI3DreadSmall(fname) ;
if (!m3d)
ErrorExit(ERROR_NOFILE,
Expand All @@ -3202,7 +3204,10 @@ main(int argc, char *argv[])
MRIwrite(mri_p_ventricle, "p_left_ventricle.mgz") ;
}

sprintf(fname, "%s/%s/mri/T1", subjects_dir,sname) ;
req = snprintf(fname, STRLEN, "%s/%s/mri/T1", subjects_dir, sname);
if (req >= STRLEN) {
std::cerr << __FUNCTION__ << ": Truncation on line " << __LINE__ << std::endl;
}
mri_T1 = MRIread(fname) ;
if (!mri_T1)
ErrorExit(ERROR_NOFILE, "%s: could not read T1 volume %s\n",
Expand Down
Loading

0 comments on commit 07a667a

Please sign in to comment.