Skip to content

Commit 25eb0ca

Browse files
authored
Merge pull request #73 from hasan7n/fixes-for-cli-segment
Fixes for cli segment
2 parents 5824666 + 76d5a6f commit 25eb0ca

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ RUN echo "Installing separate environment for LabelFusion" && \
5454
./venv/bin/pip install -e .
5555

5656
RUN echo "Downloading model weights" && \
57-
cd bin/install/appdir/usr/data/fets && \
57+
cd bin/install/appdir/usr/data && \
5858
wget https://upenn.box.com/shared/static/f7zt19d08c545qt3tcaeg7b37z6qafum.zip -O nnunet.zip && \
5959
unzip -qq nnunet.zip && rm -rf nnunet.zip && \
6060
wget https://upenn.box.com/shared/static/hhvn8nb9xtz6nxcilmdl8kbx9n1afkdu.zip -O ./fets_consensus_models.zip && \

src/applications/FeTS_CLI_Segment.cxx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ int main(int argc, char** argv)
135135
hardcodedModelWeightPath = hardcodedOpenFLPath + "/bin/federations/weights/", // start with the common location
136136
hardcodedPythonPath = hardcodedOpenFLPath + "/venv/bin/python", // this needs to change for Windows (wonder what happens for macOS?)
137137
hardcodedPythonPath_fusion = fetsApplicationPath + "/LabelFusion/venv/bin/python", // this needs to change for Windows (wonder what happens for macOS?)
138-
scriptToCall = hardcodedOpenFLPath + "/submodules/fets_ai/Algorithms/fets/bin/brainmage_validation_scores_to_disk.py"; // the script that does the inference and scoring
138+
scriptToCall = hardcodedOpenFLPath + "/submodules/fets_ai/Algorithms/fets/bin/brainmage_validation_outputs_to_disk_newer.py"; // the script that does the inference and scoring
139139
auto fets_dataDir = getCaPTkDataDir();
140140
auto hardcodedFinalModelsWeightsPath = fets_dataDir + "/fets_consensus";
141141
auto hardcodedFinalModelsSeriesWeightsPath = fets_dataDir + "/fets_consensus_models/";
@@ -260,13 +260,13 @@ int main(int argc, char** argv)
260260
std::string command_to_run;
261261

262262
auto current_temp_output = cbica::createTmpDir();
263-
auto current_subject_temp_output = current_temp_output + "/subject";
263+
auto current_subject_temp_output = current_temp_output + "/" + subjectDirs[s];
264264
cbica::createDir(current_subject_temp_output);
265265
// std::string file_t1gd, file_t1, file_t2, file_flair;
266-
auto file_t1gd_temp = current_subject_temp_output + "/t1gd.nii.gz",
267-
file_t1_temp = current_subject_temp_output + "/t1.nii.gz",
268-
file_t2_temp = current_subject_temp_output + "/t2.nii.gz",
269-
file_flair_temp = current_subject_temp_output + "/flair.nii.gz";
266+
auto file_t1gd_temp = current_subject_temp_output + "/_t1gd.nii.gz",
267+
file_t1_temp = current_subject_temp_output + "/_t1.nii.gz",
268+
file_t2_temp = current_subject_temp_output + "/_t2.nii.gz",
269+
file_flair_temp = current_subject_temp_output + "/_flair.nii.gz";
270270
cbica::copyFile(file_t1gd, file_t1gd_temp);
271271
cbica::copyFile(file_t1, file_t1_temp);
272272
cbica::copyFile(file_t2, file_t2_temp);
@@ -277,9 +277,8 @@ int main(int argc, char** argv)
277277
if (archs_split[a] == "fets_singlet")
278278
{
279279
std::cout << "== Starting inference using FeTS Singlet Consensus model...\n";
280-
auto current_output_file = current_subject_temp_output + "/segmentation.nii.gz";
281-
auto fileNameToCheck = subjectDirs[s] + "_fets_singlet_seg.nii.gz";
282-
auto current_output_file_to_check = dataDir + "/" + subjectDirs[s] + "/" + fileNameToCheck;
280+
auto fileNameToCheck = "fets_singlet.nii.gz";
281+
auto current_output_file_to_check = currentSubjectOutputDir + fileNameToCheck;
283282

284283
if (!cbica::isFile(current_output_file_to_check))
285284
{
@@ -290,13 +289,14 @@ int main(int argc, char** argv)
290289
+ " -ET " + hardcodedFinalModelsSeriesWeightsPath + "52"
291290
+ " -TC " + hardcodedFinalModelsSeriesWeightsPath + "52"
292291
+ " -WT " + hardcodedFinalModelsSeriesWeightsPath + "52"
293-
+ " -pp " + hardcodedOpenFLPlanPath + " -op " + current_outputDir + device_arg_for_second_script + " -dp " + current_temp_output + " -ptd";
292+
+ " -pp " + hardcodedOpenFLPlanPath + " -mot _fets_singlet" + " -op " + current_outputDir + device_arg_for_second_script + " -dp " + current_temp_output;
294293
if (std::system(command_to_run.c_str()) != 0)
295294
{
296295
std::cerr << "WARNING: The singlet model '52' did not run, please contact admin@fets.ai with this error.\n\n";
297296
}
298297
else
299298
{
299+
auto current_output_file = current_outputDir + "/" + subjectDirs[s] + "/" + subjectDirs[s] + "_fets_singlet_seg.nii.gz";
300300
if (cbica::isFile(current_output_file))
301301
{
302302
cbica::copyFile(current_output_file, current_output_file_to_check);
@@ -308,9 +308,8 @@ int main(int argc, char** argv)
308308
{
309309
std::cout << "== Starting inference using FeTS Triplet Consensus model...\n";
310310

311-
auto current_output_file = current_subject_temp_output + "/segmentation.nii.gz";
312-
auto fileNameToCheck = subjectDirs[s] + "_fets_triplet_seg.nii.gz";
313-
auto current_output_file_to_check = dataDir + "/" + subjectDirs[s] + "/" + fileNameToCheck;
311+
auto fileNameToCheck = "fets_triplet.nii.gz";
312+
auto current_output_file_to_check = currentSubjectOutputDir + fileNameToCheck;
314313

315314
if (!cbica::isFile(current_output_file_to_check))
316315
{
@@ -321,13 +320,14 @@ int main(int argc, char** argv)
321320
+ " -ET " + hardcodedFinalModelsSeriesWeightsPath + "69"
322321
+ " -TC " + hardcodedFinalModelsSeriesWeightsPath + "72"
323322
+ " -WT " + hardcodedFinalModelsSeriesWeightsPath + "52"
324-
+ " -pp " + hardcodedOpenFLPlanPath + " -op " + current_outputDir + device_arg_for_second_script + " -dp " + current_temp_output + " -ptd";
323+
+ " -pp " + hardcodedOpenFLPlanPath + " -mot _fets_triplet" + " -op " + current_outputDir + device_arg_for_second_script + " -dp " + current_temp_output;
325324
if (std::system(command_to_run.c_str()) != 0)
326325
{
327326
std::cerr << "WARNING: The triplet model '[69,72,52]' did not run, please contact admin@fets.ai with this error.\n\n";
328327
}
329328
else
330329
{
330+
auto current_output_file = current_outputDir + "/" + subjectDirs[s] + "/" + subjectDirs[s] + "_fets_triplet_seg.nii.gz";
331331
if (cbica::isFile(current_output_file))
332332
{
333333
cbica::copyFile(current_output_file, current_output_file_to_check);

0 commit comments

Comments
 (0)