Skip to content
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

BUG: KellyKapowski could not infer dimensionality from input #1698

Merged
merged 2 commits into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Examples/KellyKapowski.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ DiReCT(itk::ants::CommandLineParser * parser)
if (verbose)
{
std::cout << " Grey matter probability image not specified. "
<< "Creating one from the segmentation image using label value "
<< "Creating one from the segmentation image using label value "
<< direct->GetGrayMatterLabel() << std::endl;
}

Expand Down Expand Up @@ -192,7 +192,7 @@ DiReCT(itk::ants::CommandLineParser * parser)
if (verbose)
{
std::cout << " White matter probability image not specified. "
<< "Creating one from the segmentation image using label value "
<< "Creating one from the segmentation image using label value "
<< direct->GetWhiteMatterLabel() << std::endl;
}

Expand Down Expand Up @@ -376,7 +376,7 @@ DiReCT(itk::ants::CommandLineParser * parser)
if (outputOption->GetFunction(0)->GetNumberOfParameters() > 1)
{
direct->SetIncludeCumulativeVelocityFields(true);
}
}
}


Expand Down Expand Up @@ -418,9 +418,9 @@ DiReCT(itk::ants::CommandLineParser * parser)
if (outputOption->GetFunction(0)->GetNumberOfParameters() > 1)
{
direct->GetForwardCumulativeVelocityField()->Print(std::cout, 3);
ANTs::WriteImage<typename DiReCTFilterType::CumulativeVelocityFieldType>(direct->GetForwardCumulativeVelocityField(),
ANTs::WriteImage<typename DiReCTFilterType::CumulativeVelocityFieldType>(direct->GetForwardCumulativeVelocityField(),
(outputOption->GetFunction(0)->GetParameter(1) + "ForwardVelocityField.nii.gz").c_str());
ANTs::WriteImage<typename DiReCTFilterType::CumulativeVelocityFieldType>(direct->GetInverseCumulativeVelocityField(),
ANTs::WriteImage<typename DiReCTFilterType::CumulativeVelocityFieldType>(direct->GetInverseCumulativeVelocityField(),
(outputOption->GetFunction(0)->GetParameter(1) + "InverseVelocityField.nii.gz").c_str());
}
}
Expand Down Expand Up @@ -782,7 +782,7 @@ KellyKapowski(std::vector<std::string> args, std::ostream * /*out_stream = nullp
// Read in the first intensity image to get the image dimension.
std::string filename;

itk::ants::CommandLineParser::OptionType::Pointer imageOption = parser->GetOption("input-image");
itk::ants::CommandLineParser::OptionType::Pointer imageOption = parser->GetOption("segmentation-image");
if (imageOption && imageOption->GetNumberOfFunctions() > 0)
{
if (imageOption->GetFunction(0)->GetNumberOfParameters() > 0)
Expand All @@ -800,8 +800,15 @@ KellyKapowski(std::vector<std::string> args, std::ostream * /*out_stream = nullp
<< " segmentation image with the -s option" << std::endl;
return EXIT_FAILURE;
}

itk::ImageIOBase::Pointer imageIO =
itk::ImageIOFactory::CreateImageIO(filename.c_str(), itk::IOFileModeEnum::ReadMode);
if (!imageIO)
{
std::cout << "Could not create ImageIO object for file " << filename.c_str() << std::endl;
return EXIT_FAILURE;
}

dimension = imageIO->GetNumberOfDimensions();
}

Expand Down