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

STYLE: Use itk::ReadImage and itk::WriteImage in Examples/Segmentations, SpatialObjects and Statistics #5163

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sadhana-r
Copy link

@sadhana-r sadhana-r commented Jan 23, 2025

Closes #2802.

PR Checklist

@github-actions github-actions bot added area:Examples Demonstration of the use of classes area:Python wrapping Python bindings for a class type:Style Style changes: no logic impact (indentation, comments, naming) labels Jan 23, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing a pull request! 🙏

Welcome to the ITK community! 🤗👋☀️

We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. 📜
More support and guidance on the contribution process can be found in our contributing guide. 📖

This is an automatic message. Allow for time for the ITK community to be able to read the pull request and comment
on it.

Copy link
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some remarks inline. I took a closer look at the first commit, and a glancing look at the second commit.

reader->SetFileName(argv[1]);
try
{
const auto input = itk::ReadImage<ImageType>(argv[1]);
Copy link
Member

@dzenanz dzenanz Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the input has very narrow scope. It is available only between lines 96 and 98.

std::cerr << excp << std::endl;
return EXIT_FAILURE;
}
adaptor->SetImage(input);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this compile? input is probably out of scope here.

auto reader = ReaderType::New();

reader->SetFileName(argv[1]);
try
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before the try, you probably need to declare ImageType::Pointer input;.

try
{
reader->Update();
const auto input = itk::ReadImage<ImageType>(argv[1]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same scope issue as in Examples/Statistics/ImageHistogram1.cxx

@sadhana-r sadhana-r force-pushed the issue_2802_update_read_write_hackathon branch from 874d488 to 7b17773 Compare January 24, 2025 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Examples Demonstration of the use of classes area:Python wrapping Python bindings for a class type:Style Style changes: no logic impact (indentation, comments, naming)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use ReadImage and WriteImage functions where appropriate
2 participants