Comments (26)
@jilei-hao Thanks for trying the code that I put at https://godbolt.org/z/3zMceGezo ! Clearly that code does not (yet) reproduce the issue you found, even though I tried to make it similar! You're getting a link error, which is fine, because the errors that you reported should have appeared before linking, during the compilation phase.
It would be really interesting to know when such errors do and do not occur. We need it in order to know how to properly use class template argument deduction (CTAD).
So it would be helpful if you or anyone is able to reproduce those compile errors at https://godbolt.org Possibly by doing some adjustments to https://godbolt.org/z/3zMceGezo
from itk.
Still the same error for the master branch. I'll test on Windows and Linux. But making it work for Mac is also important for us.
from itk.
Just tried but it did not fix the issue.
from itk.
@jilei-hao thanks for the reproducible test case.
Addressed in #4553.
To make the RLEIteratorTest.cxx compile, a similar fix has to be applied.
from itk.
Closing this issue since it has been addressed by KitwareMedical/ITKRLEImage#63
Thanks again for everyone's prompt support!
from itk.
Thank you for contributing an issue! ๐
Welcome to the ITK community! ๐ค๐โ๏ธ
We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. ๐
Also, please check existing open issues and consider discussion on the ITK Discourse. ๐
This is an automatic message. Allow for time for the ITK community to be able to read the issue and comment on it.
from itk.
Hi,
Thank you for the reproducible example.
Conceptually, extra work is required to make RLEImage (run-length-encoded) Image with ImageScanlineIterator.
from itk.
Also, all the filters which use iterator::Value()
variant which returns a reference cannot work with RLEImage
s.
from itk.
Thanks for replying!
It used to work without problem in ITK 5.3 and before. Is there any example of the extra works needed to make it work for 5.4?
from itk.
I was about to suggest implementing a specialization of itk::ImageScanlineIterator
, but it already exists: https://github.com/KitwareMedical/ITKRLEImage/blob/master/include/itkRLEImageScanlineIterator.h
You might only need to #include "itkRLEImageScanlineIterator.h"
, possibly before filter inclusion.
from itk.
Just tried but still the same error.
https://github.com/jilei-hao/RLETest/blob/2548ad7a400959749db0b6876b29d63a8b9116c6/main.cxx#L9
https://github.com/jilei-hao/RLETest/blob/2548ad7a400959749db0b6876b29d63a8b9116c6/RLEIteratorTest.cxx#L4
from itk.
Also, the error messages are pointing to this line:
ITK/Modules/Core/Common/include/itkImageScanlineConstIterator.h at v5.4rc02 ยท InsightSoftwareConsortium/ITK ยท GitHub
from itk.
I just tried this on Linux with ITK f853303, and it compiles without issue. Both main.cxx
and RLEIteratorTest.cxx
.
from itk.
Can you try compiling with ITK master?
from itk.
Do I understand correctly that the problem only occurs on Mac? It looks like your https://github.com/jilei-hao/RLETest/tree/main compiles well on my Windows pc.
Anyway, looking at https://github.com/KitwareMedical/ITKRLEImage/blob/a3bdf29f046693dce0d6c1bc4be190e87a36e4b6/include/itkRLEImageScanlineConstIterator.h#L71 , would it possibly help if you locally replace
ImageScanlineConstIterator(const ImageType * ptr, const RegionType & region)
with
ImageScanlineConstIterator(const RLEImage<TPixel, VImageDimension, CounterType> * ptr,
const ImageRegion<VImageDimension> & region)
?
I'm not sure, but it might make it easier for the compiler to deduce the template arguments ๐คท
from itk.
What are the recommended compilers for itk5.4 on MacOS? It looks more like an apple compiler issue. I'm getting more issue from apple clang 14.0 on an arm machine. I can't even build ITK 5.4 with Module_RLEImage=ON
and Module_MorphologicalContourInterpolation=ON
from itk.
@jilei-hao I'm sorry to hear so! Do you just get more of those errors on deduction of template arguments? Or also other kinds of errors?
These are the compilers that ITK aims to support: https://github.com/InsightSoftwareConsortium/ITK/blob/1780a31476d63a3f67b97c50037bf8880224f3b9/Documentation/docs/supported_compilers.md
from itk.
@N-Dekker Thanks for the list!
Yes, the error messages were still about template deduction. These ITK compiling errors only happens on arm mac. Here's one example:
/Users/huah/jhao/dev/itk-dev/ITK/Modules/Core/Common/include/itkImageScanlineConstIterator.h:97:3: note: candidate function template not viable: requires 0 arguments, but 2 were provided
ImageScanlineConstIterator()
^
In file included from /Users/huah/jhao/dev/itk-dev/ITK/Modules/Remote/MorphologicalContourInterpolation/test/itkMorphologicalContourInterpolationTestWithRLEImage.cxx:20:
In file included from /Users/huah/jhao/dev/itk-dev/ITK/Modules/IO/ImageBase/include/itkImageFileWriter.h:264:
In file included from /Users/huah/jhao/dev/itk-dev/ITK/Modules/IO/ImageBase/include/itkImageFileWriter.hxx:33:
In file included from /Users/huah/jhao/dev/itk-dev/ITK/Modules/Core/Common/include/itkImageAlgorithm.h:221:
/Users/huah/jhao/dev/itk-dev/ITK/Modules/Core/Common/include/itkImageAlgorithm.hxx:40:37: error: no viable constructor or deduction guide for deduction of template arguments of 'ImageScanlineIterator'
itk::ImageScanlineIterator ot(outImage, outRegion);
^
/Users/huah/jhao/dev/itk-dev/ITK/Modules/Core/Common/include/itkImageScanlineIterator.h:66:3: note: candidate template ignored: substitution failure [with TImage = itk::RLEImage<unsigned char, 4>]: cannot reference member of primary template because deduced class template specialization 'ImageScanlineIterator<itk::RLEImage<unsigned char, 4>>' is instantiated from a partial specialization
ImageScanlineIterator(TImage * ptr, const RegionType & region);
^ ~~~~~~~~~~
/Users/huah/jhao/dev/itk-dev/ITK/Modules/Core/Common/include/itkImageScanlineIterator.h:102:1: note: candidate template ignored: could not match 'SmartPointer<TImage>' against 'itk::RLEImage<unsigned char, 4> *'
ImageScanlineIterator(SmartPointer<TImage>, const typename TImage::RegionType &)->ImageScanlineIterator<TImage>;
^
/Users/huah/jhao/dev/itk-dev/ITK/Modules/Core/Common/include/itkImageScanlineIterator.h:74:3: note: candidate function template not viable: requires single argument 'it', but 2 arguments were provided
ImageScanlineIterator(const ImageIterator<TImage> & it);
^
/Users/huah/jhao/dev/itk-dev/ITK/Modules/Core/Common/include/itkImageScanlineIterator.h:95:3: note: candidate function template not viable: requires single argument 'it', but 2 arguments were provided
ImageScanlineIterator(const ImageScanlineConstIterator<TImage> & it);
^
/Users/huah/jhao/dev/itk-dev/ITK/Modules/Core/Common/include/itkImageScanlineIterator.h:42:27: note: candidate function template not viable: requires 1 argument, but 2 were provided
class ITK_TEMPLATE_EXPORT ImageScanlineIterator : public ImageScanlineConstIterator<TImage>
^
/Users/huah/jhao/dev/itk-dev/ITK/Modules/Core/Common/include/itkImageScanlineIterator.h:62:3: note: candidate function template not viable: requires 0 arguments, but 2 were provided
ImageScanlineIterator() = default;
from itk.
Do all those errors specifically occur when trying to use those iterators with RLEImage? And does the adjustment that I suggested at #4537 (comment) fix any of those errors at all?
from itk.
Same issue also occurs for llvm clang 17.0.6
from itk.
What are the recommended compilers for itk5.4 on MacOS? It looks more like an apple compiler issue. I'm getting more issue from apple clang 14.0 on an arm machine. I can't even build ITK 5.4 with
Module_RLEImage=ON
andModule_MorphologicalContourInterpolation=ON
@thewtex has an ARM Mac, he might be able to help, assuming he can spare the time.
from itk.
@jilei-hao Can you please try the same adjustment to both ImageScanlineConstIterator
and ImageScanlineIterator
, as I suggested at #4537 (comment)
So also in the "non-const" itkRLEImageScanlineIterator.h, at https://github.com/KitwareMedical/ITKRLEImage/blob/a3bdf29f046693dce0d6c1bc4be190e87a36e4b6/include/itkRLEImageScanlineIterator.h#L59
Replace:
ImageScanlineIterator(ImageType * ptr, const RegionType & region)
with:
ImageScanlineIterator(RLEImage<TPixel, VImageDimension, CounterType> * ptr,
const ImageRegion<VImageDimension> & region)
Just like you did in the "const" version, at https://github.com/KitwareMedical/ITKRLEImage/blob/a3bdf29f046693dce0d6c1bc4be190e87a36e4b6/include/itkRLEImageScanlineConstIterator.h#L71
Does that fix any of the compiler errors?
If that doesn't work, I think we need to add "deduction guides" to itkRLEImageScanlineIterator.h and itkRLEImageScanlineConstIterator.h
from itk.
from itk.
Great! Thanks everyone for the help!
from itk.
Just trying to reproduce the problem online: https://godbolt.org/z/3zMceGezo But it still compiles at godbolt.org! ๐คท
from itk.
Just trying to reproduce the problem online: https://godbolt.org/z/3zMceGezo But it still compiles at godbolt.org! ๐คท
Hi @N-Dekker ,
I copied this code to my local and compiled it and got:
Undefined symbols for architecture x86_64:
"itk::ImageScanlineConstIterator<itk::RLEImage<int, 2u, unsigned short> >::ImageScanlineConstIterator(itk::RLEImage<int, 2u, unsigned short> const*, itk::ImageRegion<2u> const&)", referenced from:
___cxx_global_var_init in simple.cxx.o
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Am I missing any configuration in my compiler or cmake settings?
from itk.
Related Issues (20)
- Detailed CMake options are not marked as advanced. HOT 1
- Defaulting copy constructor, copy assignment, move constructor, and move assignment functions HOT 8
- Inconsistent conversion of VectorImage to numpy HOT 2
- itkTestDriver link error with afl-clang-fast++ compiler HOT 1
- thread race with itkImage::SetPixel() found with thread sanitizer (TSan) HOT 6
- Create weekly builds with python wrapping for ITK and its modules, and submit them to pypi HOT 1
- TubeSpatialObject bounding box includes rounded ends even after they are turned off HOT 5
- Dicom series loaded with incorrect origin and spacing (linked from SimpleITK) HOT 8
- When dicom files converted to nii.gz files, it created a bug of repeated images HOT 2
- Unable to debug hxx files and h files HOT 10
- Wrap SpatialObjectToImageStatisticsCalculator for Python
- itkWarningMacro output streams to Jupyter server console (not the notebook) HOT 4
- About itk 5.4.0 HOT 1
- NumPy 2.0 support HOT 2
- itkParallelSparseFieldLevelSetImageFilterTest read/write race with GetPixel() / SetPixel() HOT 3
- itkNarrowBandImageFilterBaseTest read/write race with GetPixel() / SetPixel() HOT 1
- 3 SLIC tests: read/write race with GetPixel() / SetPixel() HOT 1
- libtbb missing from some ITK 5.4.0 wheels
- ITK 5.4.0 GetArrayFromImage returns None HOT 2
- Cannot use RTK in 5.4rc>1 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itk.