[ITK Community] [Insight-developers] Trying to make a Single Precision ITK, any suggestions on type weirdness?
Williams, Norman K
norman-k-williams at uiowa.edu
Mon Oct 28 17:39:45 EDT 2013
Update: Spent some more time beating on this with GCC 4.4.8 and ICC, and
got it down to 5 compiler errors, all having to do with the compiler
somehow confusing itk::Point with vnl_vector and matrix types.
No idea how this didn't happen before.
--
Kent Williams norman-k-williams at uiowa.edu
On 10/25/13 4:19 PM, "Williams, Norman K" <norman-k-williams at uiowa.edu>
wrote:
>This is a project Hans put me on this morning. Basically trying to get
>ITK to where all (or almost all) its internal computation happens in
>single precision. There are several issues with actually unleashing this
>on the world, but for now I'm just trying to get ITK to build, so I can
>start testing.
>
>The core change is to make the Point, Spacing and Direction Types in
>itk::ImageBase use float instead of double.
>
>Just making this one change did cause a bunch of compiler errors, but once
>I solved the knotty problem of itkImageTransformHelper, it was mostly
>pretty trivial, obvious changes.
>
>Until I got down to this: multiplying a matrix by a vnlVector blows both
>GCC and ICC's minds, in a way I don't understand. It boils down to this
>code:
>
>typedef vnl_vector_fixed<float,3> vnlVectorType;
>typedef itk::Matrix<NumericType,3,3> MatrixType;
>
>MatrixType matrix;
>vnlVectorType v2;
>vnlVectorType resultVnlVector = matrix * v2;
>
>For which Intel ICC gives this error:
>[ 57%] Building CXX object
>Modules/Core/Common/test/CMakeFiles/ITKCommon2TestDriver.dir/itkMatrixTest
>.
>cxx.o
>ITKv4/Modules/Core/Common/test/itkMatrixTest.cxx(68): error: more than one
>operator "*" matches these operands:
> function "itk::Matrix<T, NRows, NColumns>::operator*(const
>itk::Point<T, NColumns> &) const [with T=float, NRows=3U, NColumns=3U]"
> function "itk::Matrix<T, NRows, NColumns>::operator*(const
>vnl_vector<T> &) const [with T=float, NRows=3U, NColumns=3U]"
> operand types are: MatrixType * vnlVectorType
>
>GCC 4.4.8 gives basically the same error.
>
>This makes no sense to me. It suggests that the compiler thinks the
>argument, const vnl_vector_fixed<float,3> &, is close enough in type to
>const itk::Point<float,3> & that it can't decide which version of
>operator* to use.
>
>
>Anyone have any suggestions on how to fix this? The weirdest part is that
>this test doesn't have anything to do with the change to itk::ImageBase.
>I made some minor changes to itk::Point to allow for more flexible
>initialization, but I did not make it type-compatible with
>vnl_vector_fixed!
>
>My current work is here:
>
>https://github.com/BRAINSia/ITK/tree/SinglePrecisionImageParams
>
>Thanks in advance for any help you can offer!
>--
>Kent Williams norman-k-williams at uiowa.edu
>
>
>
>
>
>
>________________________________
>Notice: This UI Health Care e-mail (including attachments) is covered by
>the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is
>confidential and may be legally privileged. If you are not the intended
>recipient, you are hereby notified that any retention, dissemination,
>distribution, or copying of this communication is strictly prohibited.
>Please reply to the sender that you have received the message in error,
>then delete it. Thank you.
>________________________________
>_______________________________________________
>Powered by www.kitware.com
>
>Visit other Kitware open-source projects at
>http://www.kitware.com/opensource/opensource.html
>
>Kitware offers ITK Training Courses, for more information visit:
>http://kitware.com/products/protraining.php
>
>Please keep messages on-topic and check the ITK FAQ at:
>http://www.itk.org/Wiki/ITK_FAQ
>
>Follow this link to subscribe/unsubscribe:
>http://www.itk.org/mailman/listinfo/insight-developers
________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
________________________________
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-developers
More information about the Community
mailing list