Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:freesurfer/freesurfer into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglas Greve committed Sep 4, 2021
2 parents 32200f7 + 7ad1a0d commit 8a2bcff
Show file tree
Hide file tree
Showing 13 changed files with 328 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,12 @@ if(INFANT_MODULE)
add_subdirectory(sscnn_skullstripping)
endif()

if(INFANT_MODULE AND MINIMAL)
add_subdirectory(mri_distance_transform)
add_subdirectory(mri_correct_segmentations)
add_subdirectory(mri_morphology)
endif()

if(TKTOOLS_MODULE)
add_subdirectory(tktools)
endif()
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# docker build for distributing a base fs 7.1.1 container
# docker build for distributing a base fs 7.2.0 container

FROM centos:7

Expand All @@ -12,7 +12,7 @@ RUN yum -y install mesa-libGL libXext libSM libXrender libXmu
RUN yum clean all

# install fs
RUN wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.1.1/freesurfer-linux-centos7_x86_64-7.1.1.tar.gz -O fs.tar.gz && \
RUN wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.2.0/freesurfer-linux-centos7_x86_64-7.2.0.tar.gz -O fs.tar.gz && \
tar --no-same-owner -xzvf fs.tar.gz && \
mv freesurfer /usr/local && \
rm fs.tar.gz
Expand Down
13 changes: 13 additions & 0 deletions distribution/average/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ if(INFANT_MODULE)
install_tarball(CNYBCH.tar.gz DESTINATION average)
endif()

if(INFANT_MODULE AND MINIMAL)
install_symlinks(
TYPE files
DESTINATION average
lh.average.curvature.filled.buckner40.tif
rh.average.curvature.filled.buckner40.tif
lh.curvature.buckner40.filled.desikan_killiany.2010-03-25.gcs
rh.curvature.buckner40.filled.desikan_killiany.2010-03-25.gcs
lh.destrieux.simple.2009-07-29.gcs
rh.destrieux.simple.2009-07-29.gcs
)
endif()

# the following data isn't required for recon-all, but will be installed by default
if(NOT MINIMAL)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ ::GetValue( const ParametersType & parameters ) const

// Add the components
double totalCost = dataCost + alphasCost + positionCost;
if ( isnan( totalCost ) || isinf( totalCost ) )
if ( std::isnan( totalCost ) || std::isinf( totalCost ) )
{
totalCost = itk::NumericTraits< double >::max();
}
Expand Down
1 change: 1 addition & 0 deletions gems/Executables/kvlBuildAtlasMesh.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ int main( int argc, char** argv )
std::vector< LabelImageType::ConstPointer > labelImages;
for ( int argumentNumber = 7; argumentNumber < argc; argumentNumber++ )
{
std::cout << "Reading input image: " << argv[ argumentNumber ] << std::endl
// Read the input image
typedef itk::ImageFileReader< LabelImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
Expand Down
3 changes: 3 additions & 0 deletions infant/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ install_symlinks(all_c_robtemplate_affine_mean.05.01.2018.nii.gz TYPE files DEST
install_pyscript(mri_label_fusion)
add_subdirectory(labelfusion)

# Entrypoint for containers
install(PROGRAMS docker/infant-container-entrypoint.bash DESTINATION bin)

# install external niftyreg binaries
if(MARTINOS_BUILD)
if(APPLE)
Expand Down
9 changes: 9 additions & 0 deletions infant/docker/infant-container-entrypoint.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Symlink the volume_mounted model files to where FreeSurfer expects them
mkdir -p $FREESURFER_HOME/average/sscnn_skullstripping
ln -s $FS_INFANT_MODEL/sscnn_skullstrip/cor_sscnn.h5 $FREESURFER_HOME/average/sscnn_skullstripping/cor_sscnn.h5
ln -s $FS_INFANT_MODEL/sscnn_skullstrip/ax_sscnn.h5 $FREESURFER_HOME/average/sscnn_skullstripping/ax_sscnn.h5
ln -s $FS_INFANT_MODEL/sscnn_skullstrip/sag_sscnn.h5 $FREESURFER_HOME/average/sscnn_skullstripping/sag_sscnn.h5

eval "$@"
41 changes: 41 additions & 0 deletions infant/docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
absl-py==0.11.0
bleach==1.5.0
certifi==2020.12.5
cycler==0.10.0
decorator==4.4.2
h5py==2.10.0
html5lib==0.9999999
imageio==2.9.0
importlib-metadata==3.4.0
joblib==1.0.0
Keras==2.2.2
Keras-Applications==1.0.4
Keras-Preprocessing==1.0.2
kiwisolver==1.3.1
Markdown==3.3.3
matplotlib==3.3.3
networkx==2.5
nibabel==3.2.1
numexpr==2.7.2
numpy==1.19.5
packaging==20.8
Pillow==8.1.0
protobuf==3.14.0
psutil==5.8.0
pyparsing==2.4.7
python-dateutil==2.8.1
PyWavelets==1.1.1
PyYAML==5.3.1
scikit-image==0.17.2
scikit-learn==0.24.0
scipy==1.5.3
six==1.15.0
sklearn==0.0
tables==3.6.1
tensorflow==1.5.0
tensorflow-tensorboard==1.5.1
threadpoolctl==2.1.0
tifffile==2020.9.3
typing-extensions==3.7.4.3
Werkzeug==1.0.1
zipp==3.4.0
2 changes: 1 addition & 1 deletion infant/infant_recon_all
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ if !(-e $datadir/$subj/mri/transforms/talairach.auto.xfm) then
set talaffine = $datadir/$subj/mri/transforms/niftyreg_affine.txt
set cmd = (reg_aladin -ref ./${targ:t:r}.nii.gz -flo $maskedfile -aff $talaffine \
-res ${talaffine:r}.nii.gz -voff)
-res ${talaffine:r}.nii.gz -voff)
echo $cmd >> $LF
echo $cmd >> $sLF
$cmd |& tee -a $LF
Expand Down
4 changes: 4 additions & 0 deletions python/requirements-extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ pandas
matplotlib
transforms3d
scikit-image==0.16.2

## Samseg vis
pyqtgraph
PyQt5
10 changes: 5 additions & 5 deletions samseg/gems_compute_binary_atlas_probs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import freesurfer as fs

from freesurfer import samseg


eps = np.finfo(float).eps

parser = fs.utils.ArgumentParser()
Expand All @@ -32,7 +31,10 @@ else:
# to call instance methods
atlas = samseg.ProbabilisticAtlas()

numberOfSubjects = len(os.listdir(args.subjects_dir))

subjectList = [ pathname for pathname in os.listdir(subjects_dir) \
if os.path.isdir(os.path.join(subjects_dir, pathname)) ]
numberOfSubjects = len(subjectList)

for level, meshCollectionFile in enumerate(args.mesh_collections):

Expand All @@ -47,8 +49,6 @@ for level, meshCollectionFile in enumerate(args.mesh_collections):
mesh = meshCollection.reference_mesh
numberOfNodes = mesh.point_count

#
subjectList = os.listdir(args.subjects_dir)
print('Number of subjects: ' + str(len(subjectList)))

# Define what we are interesting in, i.e., the label statistics of lesion
Expand All @@ -59,7 +59,7 @@ for level, meshCollectionFile in enumerate(args.mesh_collections):
# Read the manually annotated binary segmentation for the specific subject
segmentationImage = nib.load(os.path.join(args.segmentations_dir, subjectDir, args.segmentation_name)).get_fdata()

history = np.load(os.path.join(args.subjects_dir, subjectDir, 'history.p'), allow_pickle=True)
history = np.load(os.path.join(args.subjects_dir, subjectDir, 'mri/samseg/history.p'), allow_pickle=True)

# Get the node positions in image voxels
modelSpecifications = history['input']['modelSpecifications']
Expand Down
Loading

0 comments on commit 8a2bcff

Please sign in to comment.