-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from hasan7n/fixes-for-cli-segment
Fixes for cli segment
- Loading branch information
Showing
2 changed files
with
15 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,7 +135,7 @@ int main(int argc, char** argv) | |
hardcodedModelWeightPath = hardcodedOpenFLPath + "/bin/federations/weights/", // start with the common location | ||
hardcodedPythonPath = hardcodedOpenFLPath + "/venv/bin/python", // this needs to change for Windows (wonder what happens for macOS?) | ||
hardcodedPythonPath_fusion = fetsApplicationPath + "/LabelFusion/venv/bin/python", // this needs to change for Windows (wonder what happens for macOS?) | ||
scriptToCall = hardcodedOpenFLPath + "/submodules/fets_ai/Algorithms/fets/bin/brainmage_validation_scores_to_disk.py"; // the script that does the inference and scoring | ||
scriptToCall = hardcodedOpenFLPath + "/submodules/fets_ai/Algorithms/fets/bin/brainmage_validation_outputs_to_disk_newer.py"; // the script that does the inference and scoring | ||
auto fets_dataDir = getCaPTkDataDir(); | ||
auto hardcodedFinalModelsWeightsPath = fets_dataDir + "/fets_consensus"; | ||
auto hardcodedFinalModelsSeriesWeightsPath = fets_dataDir + "/fets_consensus_models/"; | ||
|
@@ -260,13 +260,13 @@ int main(int argc, char** argv) | |
std::string command_to_run; | ||
|
||
auto current_temp_output = cbica::createTmpDir(); | ||
auto current_subject_temp_output = current_temp_output + "/subject"; | ||
auto current_subject_temp_output = current_temp_output + "/" + subjectDirs[s]; | ||
cbica::createDir(current_subject_temp_output); | ||
// std::string file_t1gd, file_t1, file_t2, file_flair; | ||
auto file_t1gd_temp = current_subject_temp_output + "/t1gd.nii.gz", | ||
file_t1_temp = current_subject_temp_output + "/t1.nii.gz", | ||
file_t2_temp = current_subject_temp_output + "/t2.nii.gz", | ||
file_flair_temp = current_subject_temp_output + "/flair.nii.gz"; | ||
auto file_t1gd_temp = current_subject_temp_output + "/_t1gd.nii.gz", | ||
file_t1_temp = current_subject_temp_output + "/_t1.nii.gz", | ||
file_t2_temp = current_subject_temp_output + "/_t2.nii.gz", | ||
file_flair_temp = current_subject_temp_output + "/_flair.nii.gz"; | ||
cbica::copyFile(file_t1gd, file_t1gd_temp); | ||
cbica::copyFile(file_t1, file_t1_temp); | ||
cbica::copyFile(file_t2, file_t2_temp); | ||
|
@@ -277,9 +277,8 @@ int main(int argc, char** argv) | |
if (archs_split[a] == "fets_singlet") | ||
{ | ||
std::cout << "== Starting inference using FeTS Singlet Consensus model...\n"; | ||
auto current_output_file = current_subject_temp_output + "/segmentation.nii.gz"; | ||
auto fileNameToCheck = subjectDirs[s] + "_fets_singlet_seg.nii.gz"; | ||
auto current_output_file_to_check = dataDir + "/" + subjectDirs[s] + "/" + fileNameToCheck; | ||
auto fileNameToCheck = "fets_singlet.nii.gz"; | ||
auto current_output_file_to_check = currentSubjectOutputDir + fileNameToCheck; | ||
|
||
if (!cbica::isFile(current_output_file_to_check)) | ||
{ | ||
|
@@ -290,13 +289,14 @@ int main(int argc, char** argv) | |
+ " -ET " + hardcodedFinalModelsSeriesWeightsPath + "52" | ||
+ " -TC " + hardcodedFinalModelsSeriesWeightsPath + "52" | ||
+ " -WT " + hardcodedFinalModelsSeriesWeightsPath + "52" | ||
+ " -pp " + hardcodedOpenFLPlanPath + " -op " + current_outputDir + device_arg_for_second_script + " -dp " + current_temp_output + " -ptd"; | ||
+ " -pp " + hardcodedOpenFLPlanPath + " -mot _fets_singlet" + " -op " + current_outputDir + device_arg_for_second_script + " -dp " + current_temp_output; | ||
if (std::system(command_to_run.c_str()) != 0) | ||
{ | ||
std::cerr << "WARNING: The singlet model '52' did not run, please contact [email protected] with this error.\n\n"; | ||
} | ||
else | ||
{ | ||
auto current_output_file = current_outputDir + "/" + subjectDirs[s] + "/" + subjectDirs[s] + "_fets_singlet_seg.nii.gz"; | ||
if (cbica::isFile(current_output_file)) | ||
{ | ||
cbica::copyFile(current_output_file, current_output_file_to_check); | ||
|
@@ -308,9 +308,8 @@ int main(int argc, char** argv) | |
{ | ||
std::cout << "== Starting inference using FeTS Triplet Consensus model...\n"; | ||
|
||
auto current_output_file = current_subject_temp_output + "/segmentation.nii.gz"; | ||
auto fileNameToCheck = subjectDirs[s] + "_fets_triplet_seg.nii.gz"; | ||
auto current_output_file_to_check = dataDir + "/" + subjectDirs[s] + "/" + fileNameToCheck; | ||
auto fileNameToCheck = "fets_triplet.nii.gz"; | ||
auto current_output_file_to_check = currentSubjectOutputDir + fileNameToCheck; | ||
|
||
if (!cbica::isFile(current_output_file_to_check)) | ||
{ | ||
|
@@ -321,13 +320,14 @@ int main(int argc, char** argv) | |
+ " -ET " + hardcodedFinalModelsSeriesWeightsPath + "69" | ||
+ " -TC " + hardcodedFinalModelsSeriesWeightsPath + "72" | ||
+ " -WT " + hardcodedFinalModelsSeriesWeightsPath + "52" | ||
+ " -pp " + hardcodedOpenFLPlanPath + " -op " + current_outputDir + device_arg_for_second_script + " -dp " + current_temp_output + " -ptd"; | ||
+ " -pp " + hardcodedOpenFLPlanPath + " -mot _fets_triplet" + " -op " + current_outputDir + device_arg_for_second_script + " -dp " + current_temp_output; | ||
if (std::system(command_to_run.c_str()) != 0) | ||
{ | ||
std::cerr << "WARNING: The triplet model '[69,72,52]' did not run, please contact [email protected] with this error.\n\n"; | ||
} | ||
else | ||
{ | ||
auto current_output_file = current_outputDir + "/" + subjectDirs[s] + "/" + subjectDirs[s] + "_fets_triplet_seg.nii.gz"; | ||
if (cbica::isFile(current_output_file)) | ||
{ | ||
cbica::copyFile(current_output_file, current_output_file_to_check); | ||
|