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

Use itk::ReadImage and itk::WriteImage #226

Closed
thewtex opened this issue Mar 11, 2021 · 14 comments
Closed

Use itk::ReadImage and itk::WriteImage #226

thewtex opened this issue Mar 11, 2021 · 14 comments
Labels
Good first issue A good issue for community members new to contributing

Comments

@thewtex
Copy link
Member

thewtex commented Mar 11, 2021

Use the new functions, itk::ReadImage and itk::WriteImage, available in ITK 5.2 for simplicity over itk::ImageFileReader and itk::ImageFileWriter throughout the examples. See #225
for an illustration of the changes required.

@thewtex thewtex added the Good first issue A good issue for community members new to contributing label Mar 11, 2021
@josetascon
Copy link
Contributor

josetascon commented Jul 2, 2021

Hi @thewtex,
I would like to contribute. I have a question. Is this desired for all the examples?. If that is the case, should I make individual commits for every example?

For instance, If I check how many example files uses itkImageFileReader there are 212, while itkImageFileWriter 210. It may be convenient to commit per module (Core, Numerics, ...)

For now, I will make a single commit with the example at src/Core/Transform/ScaleAnImage/Code.cxx

@dzenanz
Copy link
Member

dzenanz commented Jul 5, 2021

commit per module

This sounds good. Or change all in one commit. There would be too many commits with one commit per example. #302 is just what we are looking for. This should be done for great majority of the examples. If reader or writer are being used to demonstrate streaming or in some other unusual way, they should be left alone.

@josetascon
Copy link
Contributor

josetascon commented Jul 6, 2021

Ok. New commit #303 with changes of examples at src/Core.
I have some notes. Some of comments are just to mention the unchanged, another file changed, some examples without test, and finally some examples that import header files but they are unnecessary.

Unchaged
* ImportPixelBufferIntoAnImage unchanged because demonstrate filter connection
* MiniPipeline unchanged because demonstrate itk pipeline
* StoreNonPixelDataInImage unchanged because reader calls reader->GetMetaDataDictionary()
* MakePartOfImageTransparent unchanged because sets extra writer parameters
* TryCatchException unchanged because use the reader to catch an exception

Changed
* ConvertArrayToImage change output format to mhd

Missing compiled binary (not added in cmake) and without test files
* MultipleInputsOfDifferentType
* MultipleOutputsOfDifferentType
* FilterImageUsingMultipleThreads
* IterateRegionWithNeighborhood
* MakeOutOfBoundsPixelsReturnConstValue
* GetOrSetMemberVariableOfITKClass
* InPlaceFilterOfImage

Not working as intended, all test passed but the output is a black image
* ContourSpatialObject
* CreateALineSpatialObject

Unused header
Import file reader and writer headers but are not used:
* FilterImage
* GetOrSetMemberVariableOfITKClass
* MultipleInputsOfSameType
* FilterImageWithoutCopying

Import file writer but unused:
* IterateImageStartingAtSeed

Import file reader but unused:
* ScaleAnImage
* CropImageBySpecifyingRegion
* IterateOverSpecificRegion
* RandomSelectPixelFromRegionWithoutReplacee
* IterateLineThroughImageWithoutWriteAccess
* MakeOutOfBoundsPixelsReturnConstValue
* RandomSelectOfPixelsFromRegion

Question, although importing the itkImageFileReader.h or itkImageFileWriter.h in those files do not create conflicts should I delete them?

@dzenanz
Copy link
Member

dzenanz commented Jul 6, 2021

If the includes are unused, they should be deleted. I guess this was created by starting a new example by copying an old one, which had some unnecessary includes.

@dzenanz
Copy link
Member

dzenanz commented Jul 6, 2021

I think it is desirable to update the non-working examples along with the working ones. Unless reading or writing are the problematic part of the example.

@dzenanz
Copy link
Member

dzenanz commented Jul 6, 2021

Perhaps the broken/unindexed examples should be updated in a separate commit?

@josetascon
Copy link
Contributor

able to update the non-working examples along with the working ones. Unless reading or writing are the problematic part of the example.

I am currently doing this.

@josetascon
Copy link
Contributor

Perhaps the broken/unindexed examples should be updated in a separate commit?

Agree, I am just reporting those for now.

@josetascon
Copy link
Contributor

If the includes are unused, they should be deleted. I guess this was created by starting a new example by copying an old one, which had some unnecessary includes.

Got it, I will include them in #303

@thewtex
Copy link
Member Author

thewtex commented Jul 9, 2021

@josetascon thank you for your contributions! 🙏

@josetascon
Copy link
Contributor

josetascon commented Jul 9, 2021

@josetascon thank you for your contributions! pray

I am happy to help :)

@josetascon
Copy link
Contributor

New commit #305.
The notes.

Unchaged:
src/Filtering/ImageGrid/ChangeImageOriginSpacingOrDirection/Code.cxx unchanged because use image reader to demonstrate update information

Missing compiled binary (cmake) and without test files:
src/Filtering/ImageStatistics/ComputePCAShapeFromSample/Code.cxx
src/Filtering/Convolution/NormalizedCorrelation/Code.cxx
src/Filtering/Convolution/ColorNormalizedCorrelation/Code.cxx
src/Filtering/ImageFeature/ApplyAFilterToASpecifiedRegionOfAnImage/Code.cxx
src/Filtering/ImageFeature/SharpenImage/Code.cxx
src/Filtering/ImageIntensity/SubtractTwoImages/Code.cxx
src/Filtering/ImageGrid/Stack2DImagesInto3DImage/Code.cxx
src/Filtering/ImageGradient/ComputeGradientMagnitude/Code.cxx
src/Filtering/ImageGradient/ComputeAndDisplayGradient/Code.cxx
src/Filtering/ImageGradient/ComputeGradientMagnitudeRecursiveGaussian/Code.cxx
src/Filtering/ImageGradient/ApplyGradientRecursiveGaussian/Code.cxx
src/Filtering/ImageGradient/ApplyGradientRecursiveGaussianWithVectorInput/Code.cxx
src/Filtering/ImageGradient/ImplementationOfSnakes/Code.cxx

@josetascon
Copy link
Contributor

New commit #306.
The notes:

Missing compiled binary (cmake) and without test files:
src/Segmentation/KLMRegionGrowing/BasicRegionGrowing/Code.cxx
src/Segmentation/ConnectedComponents/LabelConnectComponentsInBinaryImage/Code.cxx
src/Segmentation/RegionGrowing/ConnectedComponentsInImage/Code.cxx
src/Segmentation/Classifiers/KMeansClusterOfPixelsInImage/Code.cxx
src/Segmentation/Classifiers/KMeansClustering/Code.cxx
src/Segmentation/Classifiers/ClusterPixelsInGrayscaleImage/Code.cxx
src/Segmentation/LevelSets/SegmentWithGeodesicActiveContourLevelSet/Code.cxx
src/Numerics/Statistics/DistributionOfPixelsUsingGMM/Code.cxx
src/Numerics/Statistics/ComputeHistogramOfMaskedRegion/Code.cxx
src/Registration/Common/WatchRegistration/Code.cxx
src/Registration/Common/Perform2DTranslationRegistrationWithMeanSquares/Code.cxx

@josetascon
Copy link
Contributor

Final commit #307.

The notes:
Unchaged files:
src/IO/ImageBase/ReadAnImage/Code.cxx unchanged because this example show the reader filter
src/IO/ImageBase/WriteAnImage/Code.cxx unchanged because this example show the writer filter
src/IO/ImageBase/RegisterIOFactories/Code.cxx unchanged because use the reader to get different metadata
src/IO/ImageBase/ReadUnknownImageType/Code.cxx unchanged because creates a function to read the image
src/IO/TIFF/WriteATIFFImage/Code.cxx unchaged because use the writer filter to SetImageIO
src/Video/BridgeOpenCV/ConvertAnITKGrayScaleImageToCVMat/Code.cxx unchanged because catch exception when reading

Missing compiled binary (cmake) and without test files:
All examples in src/Developer/ require a cmake file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue A good issue for community members new to contributing
Projects
None yet
Development

No branches or pull requests

3 participants