[Insight-users] PNGwriter writes wrong scaling information

Johnson, Hans J hans-johnson at uiowa.edu
Tue Dec 11 09:49:51 EST 2012


Dženan,

In other parts of ITK, the file format units are converted to mm.  While this is not strictly enforced or adhered to, in most cases converting to/from mm when writing/reading from disk seems to be the most sensible and most expected thing to do.

Hans
=================================================================
Hans J. Johnson, Ph.D.
Assistant Professor, Department of Psychiatry

Mailing Address:
W274 GH                             Email: hans-johnson at uiowa.edu<mailto:hans-johnson at uiowa.edu>
200 Hawkins Drive                   Phone: (319) 353 8587
The University of Iowa
Iowa City, IA 52242

From: Dženan Zukić <dzenanz at gmail.com<mailto:dzenanz at gmail.com>>
Date: Tuesday, December 11, 2012 8:42 AM
To: Bill Lorensen <bill.lorensen at gmail.com<mailto:bill.lorensen at gmail.com>>
Cc: Insight-users <insight-users at itk.org<mailto:insight-users at itk.org>>
Subject: Re: [Insight-users] PNGwriter writes wrong scaling information

PNG has three following units: meters, radians, and unknown. Currently PNG reader ignores unit, and writes unknown units.

I guess I Should keep writing unknown units. But when reading PNG with meter units (eg. 2000 pixels/meter), should I transform it into pixel spacing 0.5 (assuming customary millimeter) or into 0.0005?


On Tue, Dec 11, 2012 at 3:36 PM, Bill Lorensen <bill.lorensen at gmail.com<mailto:bill.lorensen at gmail.com>> wrote:
No units. ITK considers units an application thing. You can add a unit
type if the format supports it. It could help applications. For
example, most medical images use mm's.

On Tue, Dec 11, 2012 at 8:25 AM, Dženan Zukić <dzenanz at gmail.com<mailto:dzenanz at gmail.com>> wrote:
> Is ITK still assuming no units, or millimeters are units for pixel spacing?
>
>
> On Mon, Dec 10, 2012 at 5:25 PM, Bill Lorensen <bill.lorensen at gmail.com<mailto:bill.lorensen at gmail.com>>
> wrote:
>>
>> If you submit a gerrit patch, I'll write or modify a test.
>>
>> How will we know if the fix works unless we test it? How will we know
>> if someone reintroduces the bug if we don't test it?
>>
>>
>> On Mon, Dec 10, 2012 at 10:41 AM, Dženan Zukić <dzenanz at gmail.com<mailto:dzenanz at gmail.com>> wrote:
>> > But this would be a bug fix, not a patch introducing new features. This
>> > should already be working, and ideally having a test.
>> >
>> > I know that many bugs don't get fixed, because they are not important
>> > enough
>> > and there is not enough people working on ITK. However a requirement to
>> > write a 20-30 line test for a few lines of fixed code is a great
>> > deterrence
>> > for me to contribute bug fixes (such as this one).
>> >
>> >
>> > On Mon, Dec 10, 2012 at 4:26 PM, Bill Lorensen <bill.lorensen at gmail.com<mailto:bill.lorensen at gmail.com>>
>> > wrote:
>> >>
>> >> Looks like ti should be fixed. But if you submit a gerrit patch, make
>> >> sure oyu also supply a test or modify an existing test.
>> >>
>> >> The lack of a test is why your previous gerrit patch has not been
>> >> approved.
>> >>
>> >> Bill
>> >>
>> >> On Mon, Dec 10, 2012 at 8:35 AM, Dženan Zukić <dzenanz at gmail.com<mailto:dzenanz at gmail.com>>
>> >> wrote:
>> >> > Hi everyone,
>> >> >
>> >> > I have noticed that ImageFileWriter, when writing png format, writes
>> >> > wrong
>> >> > pixel size information. It is not completely wrong, but it is not in
>> >> > accordance with png specification.
>> >> >
>> >> > When reading such files with OpenCV, I get following warning:
>> >> > libpng warning: Invalid sCAL ignored: invalid unit
>> >> > This is not just annoying and clutter-causing, but displaying it for
>> >> > every
>> >> > single image slows down my OpenCV processing.
>> >> >
>> >> > I used XnView to batch-edit the extracted slices and set some scaling
>> >> > which
>> >> > adheres to the specification to get rid of this warning.
>> >> >
>> >> > Now the question: should I correct this bug, or submit a bug report?
>> >> > My
>> >> > last
>> >> > bug-fixing ended non-gloriously :(
>> >> >
>> >> > _____________________________________
>> >> > Powered by www.kitware.com<http://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://www.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-users
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Unpaid intern in BillsBasement at noware dot com
>> >
>> >
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>
>



--
Unpaid intern in BillsBasement at noware dot com



________________________________
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.
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121211/cf220433/attachment.htm>


More information about the Insight-users mailing list