Skip to content

Commit

Permalink
Merge pull request CBICA#1493 from AlexanderGetka-cbica/add-ibsi2-gui
Browse files Browse the repository at this point in the history
[BraTSPipeline] Move brain-masked image write to Skull Stripping instead of Brain Tumor step
  • Loading branch information
AlexanderGetka-cbica authored May 6, 2022
2 parents 716ef7f + 57f22a1 commit 33cf03c
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/applications/BraTSPipeline.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -365,34 +365,35 @@ int main(int argc, char** argv)
cbica::ReadImage< TImageType >(brainMaskFile),
finalBrainMask
);
}

if (brainTumor)
{
/// [6] Brain Tumor Segmentation
auto brainTumorMaskFile = outputDir + "/dmOut_tumor/tumors_SRI.nii.gz";

if (!cbica::exists(brainTumorMaskFile))
// iterate over outputRegisteredMaskedImages to write brain-masked images before brain-tumor step
for (auto it = outputRegisteredMaskedImages.begin(); it != outputRegisteredMaskedImages.end(); it++)
{
// iterate over outputRegisteredMaskedImages
for (auto it = outputRegisteredMaskedImages.begin(); it != outputRegisteredMaskedImages.end(); it++)
{
auto modality = it->first;
auto maskFilter = itk::MaskImageFilter< ImageType, ImageType >::New();
maskFilter->SetInput(cbica::ReadImage< ImageType >(outputRegisteredImages[modality]));
maskFilter->SetMaskImage(cbica::ReadImage< TImageType >(finalBrainMask));
try
{
maskFilter->Update();
maskFilter->Update();
}
catch (const std::exception& e)
{
std::cerr << "Something went wrong when applying the brain mask to modality '"
<< modality << "': " << e.what();
return EXIT_FAILURE;
std::cerr << "Something went wrong when applying the brain mask to modality '"
<< modality << "': " << e.what();
return EXIT_FAILURE;
}
cbica::WriteImage< ImageType >(maskFilter->GetOutput(), it->second); // write the masked image
}
}
}

if (brainTumor)
{
/// [6] Brain Tumor Segmentation
auto brainTumorMaskFile = outputDir + "/dmOut_tumor/tumors_SRI.nii.gz";

if (!cbica::exists(brainTumorMaskFile))
{
fullCommand = " -md " + captkDataDir + "/deepMedic/saved_models/brainTumorSegmentation/ " +
"-i " + outputRegisteredMaskedImages["T1"] + "," +
outputRegisteredMaskedImages["T1CE"] + "," +
Expand Down

0 comments on commit 33cf03c

Please sign in to comment.