-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the code more generalizable to non-human template #53
Conversation
-- Spinal Cord Toolbox (git-master-e740edf4c8408ffa44ef7ba23ad068c6d07e4b87) sct_run_batch --
…e more compatible with sct_run_batch include-list
coord = im_discs.getNonZeroCoordinates(sorting = 'z', reverse_coord = True) | ||
coord_physical = [] | ||
for c in coord: | ||
if c.value <= last_disc or c.value in [48, 49, 50, 51, 52]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this be a problem in non-human templates?
centerline.save_centerline(fname_output = fname_centerline) | ||
print(subject_name + ' SC segmentation does not exist. Extracting centerline from ' + fname_image) | ||
im_seg = Image(fname_image).change_orientation('RPI') | ||
param_centerline = ParamCenterline(algo_fitting = 'optic', smooth = smooth, degree = 5, minmax = minmax) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP8
preprocess_normalize.py
Outdated
|
||
list_centerline.append(centerline) | ||
tqdm_bar.update(1) | ||
tqdm_bar.close() | ||
os.chdir(current_path) | ||
return list_centerline | ||
|
||
# def compute_ICBM152_centerline(dataset_info): ###### FIX | ||
# def compute_ICBM152_centerline(dataset_info): # ?????? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace the ????? by an issue on GH that points to the line of code that you don't understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- As per previous discussions, the configuration file should not include ALL parameters, but only parameters that enable to reproduce the experiments. Parameters that should not be included include: jobs (bc it depends on local hardware), path-output (bc it depends on prefered user organization),
path_data
andpath_output
should be with "-" instead of "_". Please change everywhere appropriatescript
: remove from config filepath_output
--> should not be in the config file
…nd updating README according to how users should run 'sct_run_batch'
Suggestions about
In general, However, I could see the advantages of the proposed approach:
Cons:
|
some TODOs remain
FILE="${SUBJECT}${IMAGE_SUFFIX}.nii.gz" | ||
FILESEG="${SUBJECT}${IMAGE_SUFFIX}_label-SC_seg.nii.gz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be looking in the derivative folder of the data
preprocess_segment.sh
Outdated
echo "Not found. Proceeding with automatic segmentation." | ||
# Segment spinal cord | ||
sct_deepseg_sc -i ${FILE} -o ${FILESEG} -c ${CONTRAST} -qc ${PATH_QC} -qc-subject ${SUBJECT} | ||
# TODO: MOVE THAT FILE UNDER derivatives/labels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NadiaBlostein after thinking more about it, I think we should not move the outputs in the derivatives folder of the dataset automatically. The reason is that, if someone tries running the script, it will overwrite the data in the derivatives, which will be an annoyance.
Instead, we should do this move while doing the manual correction of the segmentations/labels. In fact, this is what is currently done by other projects. Also see #58
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 73 and 89 of preprocess_segment.sh
check if the files exist to avoid overwriting anything. This also allows the straightening.cache
, straight_ref.nii.gz
, warp_curve2straight.nii.gz
and warp_straight2curve.nii.gz
for each subject to be saved separately.
However, if you prefer us to remain consistent with what everyone else does, I’ll take a look through the other projects to find a repository that I could use as a blueprint for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preprocess_segment.py is not used anymore, is it? I’m not sure I understand your comment.
Also: straightening.cache etc. have nothing to do with my comment because these files were not copied anyway. I think there is a misunderstanding that will
likely be better resolved in a meeting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My apologies, I made a typo (was on phone); was referring to preprocess_segment.sh
. Will correct comment now.
I understood that you may have at least wanted the subject-specific warp files saved. We'll chat next week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My apologies, I made a typo (was on phone); was referring to preprocess_segment.sh. Will correct comment now.
👍
I understood that you may have at least wanted the subject-specific warp files saved. We'll chat next week.
No. What I meant in the meeting is that we want these subject-specific files in their own folders (as opposed to a flat directory where there could be file conflicts)-- I did not mean that these data should be ultimately stored in the git-annexed source data
preprocess_segment.sh
Outdated
mv "${SUBJECT}${IMAGE_SUFFIX}_label-SC_seg_labeled_discs.nii.gz" "${SUBJECT}${IMAGE_SUFFIX}_label-disc.nii.gz" | ||
# TODO: MOVE THAT FILE UNDER derivatives/labels | ||
mv "${SUBJECT}${IMAGE_SUFFIX}_label-SC_seg_labeled.nii.gz" "${SUBJECT}${IMAGE_SUFFIX}_label-disc_levels.nii.gz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be moved to derivatives
scrap that (see https://github.com/neuropoly/template/pull/53/files#r1261649236)
# Copy source images | ||
rsync -avzh $PATH_DATA/$SUBJECT . | ||
rsync -avzh $PATH_DATA/$SUBJECT/$DATA_TYPE/* . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all subject files should not be in a flat directory, but instead each subject in its own directory-- to avoid file conflicts-- please do it as we do in: https://spine-generic.readthedocs.io/analysis-pipeline.html
This PR is about executing steps 1.1 to 1.4 in (see README).
In order to test this PR:
clone the repository, and get the latest version of this branch
get the data:
edit config file using these info:
Test this PR
Before testing this PR, this should be done: neuropoly/data-management#248
Fixes #25, #29, #31, #34, #37, #50, #51