Skip to content

Commit

Permalink
v2.1a3 bugfix for crashes during dilation, add local debug tools to w…
Browse files Browse the repository at this point in the history
…eb interface
  • Loading branch information
kjamison committed Oct 23, 2021
1 parent fc00329 commit acadc6c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
2 changes: 1 addition & 1 deletion website/config/nemo-version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"nemo_version": "2.1a2",
"nemo_version": "2.1a3",
"nemo_version_date": "2021-10-22"
}
14 changes: 8 additions & 6 deletions website/config/nemo_startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,14 @@ for o in $(echo ${output_prefix_list} | tr "," " "); do
#to get the filename with dilation
out_dilation_fmt=$(echo $atlasline | jq --raw-output '.parcfile_dilated_format //empty')
if [ "${out_dilation_fmt}" = "compute" ] && [ "${out_dilation}" != "0" ]; then
#Dilate the parcellation by x mm to make sure we catch nearby streamlines
out_filename_dilated=$(echo ${out_filename} | sed -E 's#\.(NII|nii)(\.GZ|\.gz)?$##')_dil${out_dilation}.nii.gz
echo "Dilating parcellation volume by ${out_dilation}mm. New parcellation: ${out_filename_dilated}"
python dilate_parcellation.py -dilatemm ${out_dilation} ${out_filename} ${out_filename_dilated}
out_filename=${out_filename_dilated}
if [ "${out_dilation_fmt}" = "compute" ]; then
if [ "${out_dilation}" != "0" ]; then
#Dilate the parcellation by x mm to make sure we catch nearby streamlines
out_filename_dilated=$(echo ${out_filename} | sed -E 's#\.(NII|nii)(\.GZ|\.gz)?$##')_dil${out_dilation}.nii.gz
echo "Dilating parcellation volume by ${out_dilation}mm. New parcellation: ${out_filename_dilated}"
python dilate_parcellation.py -dilatemm ${out_dilation} ${out_filename} ${out_filename_dilated}
out_filename=${out_filename_dilated}
fi
elif [ "x${out_dilation_fmt}" != x ]; then
#this is used for pre-dilated subject-specific parcellations, ie fs86_dil%d_allsubj.npz
out_filename=${atlasdir}/$(printf ${out_dilation_fmt} ${out_dilation})
Expand Down
34 changes: 33 additions & 1 deletion website/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,18 @@ function showUploader(run_internal_script) {
extra_html+=['<input type="checkbox" id="debug" name="debug" value="1">',
'<label for="debug">Run in debug mode</label><br/><br/>'].join('\n');

extra_html+=['<button id="add_all_atlases" onclick="addAllAtlases()">Add all atlases</button>',
'<button id="set_all_dilations0" onclick="setAllDilations(0)">Dilation 0</button>',
'<button id="set_all_dilations1" onclick="setAllDilations(1)">Dilation 1</button>',
'<button id="set_all_dilations2" onclick="setAllDilations(2)">Dilation 2</button>',
'<button id="set_all_dilations3" onclick="setAllDilations(3)">Dilation 3</button>',
'</br>'].join('\n');

//For now, lets only offer this option for debugging purposes
extra_accum_html=['<input type="checkbox" id="cumulative" name="cumulative" value="1">',
'<label for="cumulative">Accumulate total hits along streamline (Much smaller ChaCo scores)</label><br/>'].join('\n');


}

extra_algo_html=['<label for="tracking_algorithm_select">Tractography algorithm:</label>',
Expand Down Expand Up @@ -267,7 +276,7 @@ function showUploader(run_internal_script) {

var gittxt=" [<a class='gitlink' href='https://github.com/kjamison/nemo#readme' target='_blank'>github docs</a>]";
//get version info
if(document.URL.startsWith("file:///")){
if(run_local_script){
nemo_version_info={nemo_version: "LOCAL", nemo_version_date: "TODAY"};
document.getElementById('version').innerHTML="NeMo vLOCAL"+gittxt;
} else {
Expand Down Expand Up @@ -311,6 +320,29 @@ function neutralMessage(message,keep_buttons_disabled){
}


//Debugging functions
function addAllAtlases(){
var parcsel_id="addparc_select";
var parcsel=document.getElementById(parcsel_id);
atlaslist=Object.keys(atlasinfo);
for(var i=0; i<atlaslist.length; i++){
parcsel.value=atlaslist[i];
addOutput("parc",parcsel_id);
}
}
function setAllDilations(dilation){
if(dilation===undefined)
dilation=3;

var nextparc=parseInt(getNextAvailableId("addparc",1).replace("addparc",""));
for(var i=1; i<nextparc; i++){
var dilsel=document.getElementById("addparc"+i+"_dilselect");
if(dilsel)
dilsel.value=dilation
}
}


function getTrackingAlgoSelectHtml(id){
var htmlTemplate=['<select id="'+id+'" name="'+id+'">'];
algonames=Object.keys(tracking_algo_info);
Expand Down

0 comments on commit acadc6c

Please sign in to comment.