Skip to content

Commit 801b8ce

Browse files
author
Douglas Greve
committed
Merge branch 'dev' of github.com:freesurfer/freesurfer into dev
2 parents 3dba15e + 3cd3028 commit 801b8ce

File tree

5 files changed

+26
-33
lines changed

5 files changed

+26
-33
lines changed

freeview/DialogPreferences.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ DialogPreferences::DialogPreferences(QWidget *parent) :
8282

8383
#ifdef Q_OS_MAC
8484
ui->groupBoxMac->setEnabled(true);
85-
ui->groupBoxMac->show();
85+
ui->groupBoxMac->hide();
8686
// connect(ui->checkBoxMacUnified, SIGNAL(toggled(bool)), mainwnd, SLOT(SetUnifiedTitleAndToolBar(bool)));
8787
connect(ui->checkBoxCommandKey, SIGNAL(toggled(bool)), mainwnd, SLOT(SetUseCommandControl(bool)));
8888
#else

freeview/Interactor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <QDebug>
2626

2727
#ifdef Q_OS_MAC
28-
Qt::KeyboardModifier Interactor::CONTROL_MODIFIER = Qt::MetaModifier;
28+
Qt::KeyboardModifier Interactor::CONTROL_MODIFIER = Qt::ControlModifier;
2929
Qt::Key Interactor::CONTROL_KEY = Qt::Key_Meta;
3030
#else
3131
Qt::KeyboardModifier Interactor::CONTROL_MODIFIER = Qt::ControlModifier;
@@ -53,7 +53,7 @@ void Interactor::SetAction( int nAction )
5353
void Interactor::SetUseCommandControl(bool b)
5454
{
5555
#ifdef Q_OS_MAC
56-
if (b)
56+
if (true)
5757
{
5858
CONTROL_MODIFIER = Qt::ControlModifier;
5959
CONTROL_KEY = Qt::Key_Control;

mri_synthseg/mri_synthseg

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def main():
4343
parser.add_argument("--parc", action="store_true", help="(optional) Whether to perform cortex parcellation.")
4444
parser.add_argument("--robust", action="store_true", help="(optional) Whether to use robust predictions (slower).")
4545
parser.add_argument("--fast", action="store_true", help="(optional) Bypass some processing for faster prediction.")
46+
parser.add_argument("--ct", action="store_true", help="(optional) Clip CT scans in Hounsfield scale to [0, 80]")
4647
parser.add_argument("--vol", help="(optional) Output CSV file with volumes for all structures and subjects.")
4748
parser.add_argument("--qc", help="(optional) Output CSV file with qc scores for all subjects.")
4849
parser.add_argument("--post", help="(optional) Posteriors output(s). Must be a folder if --i designates a folder.")
@@ -144,6 +145,7 @@ def main():
144145
names_qc=names_qc_labels,
145146
cropping=args.crop,
146147
topology_classes=topology_classes,
148+
ct=args.ct,
147149
)
148150

149151

@@ -174,7 +176,8 @@ def predict(path_images,
174176
labels_qc,
175177
names_qc,
176178
cropping,
177-
topology_classes):
179+
topology_classes,
180+
ct):
178181
'''
179182
Prediction pipeline.
180183
'''
@@ -258,6 +261,7 @@ def predict(path_images,
258261

259262
# preprocessing
260263
image, aff, h, im_res, shape, pad_idx, crop_idx = preprocess(path_image=path_images[i],
264+
ct=ct,
261265
crop=cropping,
262266
min_pad=min_pad,
263267
path_resample=path_resampled[i])
@@ -491,7 +495,7 @@ def prepare_output_files(path_images, out_seg, out_posteriors, out_resampled, ou
491495
out_qc, unique_qc_file
492496

493497

494-
def preprocess(path_image, n_levels=5, crop=None, min_pad=None, path_resample=None):
498+
def preprocess(path_image, ct, n_levels=5, crop=None, min_pad=None, path_resample=None):
495499

496500
# read image and corresponding info
497501
im, _, aff, n_dims, n_channels, h, im_res = get_volume_info(path_image, True)
@@ -526,6 +530,8 @@ def preprocess(path_image, n_levels=5, crop=None, min_pad=None, path_resample=No
526530
crop_idx = None
527531

528532
# normalise image
533+
if ct:
534+
im = np.clip(im, 0, 80)
529535
im = rescale_volume(im, new_min=0, new_max=1, min_percentile=0.5, max_percentile=99.5)
530536

531537
# pad image

mris_convert/mris_convert.cpp

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343

4444
#include "compilerdefs.h"
4545

46+
#include "MRISurfOverlay.h"
47+
4648
#define __COMBINESURFS_TAKE_INFILE2 0
4749

4850
//------------------------------------------------------------------------
@@ -488,26 +490,9 @@ main(int argc, char *argv[])
488490

489491
static void __convertOverlayFile(MRIS *mris, const char *fcurv, char *out_fname)
490492
{
491-
if (MRISreadCurvatureFile(mris, fcurv) != NO_ERROR)
492-
{
493-
printf("ERROR reading curvature file %s\n", fcurv);
494-
exit(1);
495-
}
496-
497-
int type = MRISfileNameType(out_fname) ;
498-
if (type == MRIS_ASCII_FILE)
499-
{
500-
mrisWriteAsciiCurvatureFile(mris, out_fname);
501-
//writeAsciiCurvFile(mris, out_fname) ;
502-
}
503-
else if (type == MRIS_GIFTI_FILE)
504-
{
505-
MRISwriteGIFTI(mris, NIFTI_INTENT_SHAPE, out_fname, fcurv);
506-
}
507-
else
508-
{
509-
MRISwriteCurvature(mris, out_fname) ;
510-
}
493+
MRISurfOverlay *fsOverlay = new MRISurfOverlay();
494+
fsOverlay->read(fcurv, TRUE, mris);
495+
fsOverlay->write(out_fname, mris);
511496
}
512497

513498

utils/mrisurf_io.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5062,10 +5062,18 @@ int MRISreadCurvatureFile(MRI_SURFACE *mris, const char *sname)
50625062
frame = MRISgetReadFrame();
50635063

50645064
// ??? why read the volume twice ???
5065-
TempMRI = MRIreadHeader(fname, mritype);
5065+
//TempMRI = MRIreadHeader(fname, mritype);
5066+
//if (TempMRI == NULL) {
5067+
// return (ERROR_BADFILE);
5068+
//}
5069+
5070+
// MRI_CURV_FILE will be read in as MRI - MRISreadCurvAsMRI();
5071+
// MRI_MGH_FILE - mghRead()
5072+
TempMRI = MRIread(fname);
50665073
if (TempMRI == NULL) {
50675074
return (ERROR_BADFILE);
50685075
}
5076+
50695077
if (TempMRI->nframes <= frame) {
50705078
printf("ERROR: attempted to read frame %d from %s\n", frame, fname);
50715079
printf(" but this file only has %d frames.\n", TempMRI->nframes);
@@ -5076,14 +5084,8 @@ int MRISreadCurvatureFile(MRI_SURFACE *mris, const char *sname)
50765084
printf("ERROR: number of vertices in %s does not match surface (%d,%d)\n", sname, nv, mris->nvertices);
50775085
return (1);
50785086
}
5079-
MRIfree(&TempMRI);
5087+
//MRIfree(&TempMRI);
50805088

5081-
// MRI_CURV_FILE will be read in as MRI - MRISreadCurvAsMRI();
5082-
// MRI_MGH_FILE - mghRead()
5083-
TempMRI = MRIread(fname);
5084-
if (TempMRI == NULL) {
5085-
return (ERROR_BADFILE);
5086-
}
50875089
vno = 0;
50885090
curvmin = 10000.0f;
50895091
curvmax = -10000.0f; /* for compiler warnings */

0 commit comments

Comments
 (0)