[Insight-users] [ITK Community] Problem with LandmarkWarping2.cxx in ITK-4.4.0?

Johnson, Hans J hans-johnson at uiowa.edu
Fri Nov 22 16:35:10 EST 2013


Seth,

Registration is done in PHYSICAL space, not pixel space.  I think the problems you are running into

PhysicalSpace = DirectionCos*Spacing*PixelIndex+Origin

The previous bug is that “Spacing” was not being interpreted properly for JPEG images.  Based on your image, it appears as if perhaps you now have an “origin” adding problem.

Hans

From: Seth Parker <csparker247 at gmail.com<mailto:csparker247 at gmail.com>>
Date: Friday, November 22, 2013 at 3:30 PM
To: "insight-users at itk.org<mailto:insight-users at itk.org>" <insight-users at itk.org<mailto:insight-users at itk.org>>, Hans Johnson <hans-johnson at uiowa.edu<mailto:hans-johnson at uiowa.edu>>
Subject: Fwd: [Insight-users] [ITK Community] Problem with LandmarkWarping2.cxx in ITK-4.4.0?

Realized this got sent to insight-dev's which I'm not a part of, so it bounced it back. Forwarding so that it's tracked in insight-users.

---------- Forwarded message ----------
From: Seth Parker <csparker247 at gmail.com<mailto:csparker247 at gmail.com>>
Date: Fri, Nov 22, 2013 at 3:49 PM
Subject: Re: [Insight-users] [ITK Community] Problem with LandmarkWarping2.cxx in ITK-4.4.0?
To: "Johnson, Hans J" <hans-johnson at uiowa.edu<mailto:hans-johnson at uiowa.edu>>
Cc: Luis Ibanez <luis.ibanez at kitware.com<mailto:luis.ibanez at kitware.com>>, ITK <insight-developers at itk.org<mailto:insight-developers at itk.org>>


You'll have to forgive me; I'm a video editor by trade and have been at a steep learning curve to get this far into the troubleshooting. Let me make sure I understand. Essentially, the disparate ppi's in my images are causing my issue. If, just by example, all of my images were set to the same ppi, things should work correctly. My use of JPEGs caused the difference of outputs that I was interpreting as correct behavior.

Assuming this is the concept, I went back and ran a test from my original TIF images (they're in the 100MB range so I wasn't using them before). I changed everything to 72 ppi in Photoshop without resampling so that every image had the same dimensions as before, then ran LandmarkWarping2 again. This time, 4.3.2 and 4.4.0 did produce the same output, but it didn't produce a correct output, at least not how I understand Landmark Warping should work. This is what that output yielded: https://dl.dropboxusercontent.com/u/13015285/Chad-4.4.0-005.jpg (Note: This is a jpeg made from the output tif, just to cut down on filesize).

It seems as if the output is at the appropriate scale, but it obviously is not in the expected spot. Am I just missing something in the concept of landmark warping, did I not understand that voxel spacing concept, or is there something else going on?

Thank you all so much for your help. I'm going to try the suggested "SetOutputParameters" change, too, to see what happens.

Seth Parker
Video Editor | The University of Kentucky Vis Center
www.csethparker.com<http://www.csethparker.com> | www.vis.uky.edu<http://www.vis.uky.edu>


On Fri, Nov 22, 2013 at 2:10 PM, Johnson, Hans J <hans-johnson at uiowa.edu<mailto:hans-johnson at uiowa.edu>> wrote:
Luis:  THANK YOU FOR LOOKING INTO THIS!
Seth:  I think you were depending on a "bug" in the JPEGIO code to get the desired behavior you wanted.
===============

As an experiment, if you convert each of your images to tif format and run the 4.3.2 version of the code, you will have consistent results with both ITK4.3.2 and ITK4.4.0.

1-StaticImage.jpg*   <-- 5412 × 7216 pixels, 304.79 pixels/inch
2-MovingImage.jpg* <-- 4800 × 5434 pixels, 72 pixels/inch
LandmarkWarped-ITK4.3.2.jpg <-- 5412 × 7216 pixels, 72 pixels/inch
LandmarkWarped-ITK4.4.0.jpg  <-- 5412 × 7216 pixels, 72 pixels/inch

For the resampling stage of the output you are propagating the input image voxel counts, but not the input image voxel spacings.

My guess is that you want to use "SetOutputParametersFromImage(const ImageBaseType *image);" and pass the input image for your call to the "itk::ResampleImageFilter".

This will result in an output image with the same pixels/inch as your input image.

Hans


From: Luis Ibanez <luis.ibanez at kitware.com<mailto:luis.ibanez at kitware.com>>
Date: Friday, November 22, 2013 12:03 PM
To: Hans Johnson <hans-johnson at uiowa.edu<mailto:hans-johnson at uiowa.edu>>

Subject: Re: [Insight-users] [ITK Community] Problem with LandmarkWarping2.cxx in ITK-4.4.0?

Hans,

Here is what I found:

aleph $ git bisect bad

Bisecting: 0 revisions left to test after this (roughly 0 steps)
[b7c71079a70b33a4018e132b31ee2fc0a36b8129] ENH: JPEG IO now writes and reads spacing, similar to the TIFF IO (ITK-3023)
aleph $ git log --oneline -1
b7c7107 ENH: JPEG IO now writes and reads spacing, similar to the TIFF IO (ITK-3023)


aleph $ git bisect bad


b7c71079a70b33a4018e132b31ee2fc0a36b8129 is the first bad commit


commit b7c71079a70b33a4018e132b31ee2fc0a36b8129
Author: Marco Feuerstein <marco.feuerstein at gmail.com<mailto:marco.feuerstein at gmail.com>>
Date:   Tue Apr 30 12:01:29 2013 +0200

    ENH: JPEG IO now writes and reads spacing, similar to the TIFF IO (ITK-3023)

    Change-Id: I5f40e226040233672eed3dcdec1a5b9007899574

:040000 040000 61ddc795f11d33660d4aba2c5d74059256b0ab6f c3402b325c2329b6ab88919270e0b98b70402c0d MModules



So, it seems that the problem is not with the Landmark Deformation itself,
but
with the fact that we now put spacing information in the resulting output jpg image.

https://github.com/Kitware/ITK/commit/b7c71079a70b33a4018e132b31ee2fc0a36b8129


   Luis



On Fri, Nov 22, 2013 at 12:26 PM, Luis Ibanez <luis.ibanez at kitware.com<mailto:luis.ibanez at kitware.com>> wrote:
Hans,

I'm playing with the git bisect, while I sit in long meetings...
I'm making progress (5 steps to go).

Will let you know how far I get.

   Thanks

      Luis


On Fri, Nov 22, 2013 at 11:11 AM, Johnson, Hans J <hans-johnson at uiowa.edu<mailto:hans-johnson at uiowa.edu>> wrote:
Seth,

We discussed this at our t-con this morning.  I'll try to look at it this weekend.

Hans


From: Seth Parker <csparker247 at gmail.com<mailto:csparker247 at gmail.com>>
Date: Friday, November 22, 2013 10:09 AM
To: Matt McCormick <matt.mccormick at kitware.com<mailto:matt.mccormick at kitware.com>>
Cc: "insight-users at itk.org<mailto:insight-users at itk.org>" <insight-users at itk.org<mailto:insight-users at itk.org>>
Subject: Re: [Insight-users] [ITK Community] Problem with LandmarkWarping2.cxx in ITK-4.4.0?

I had to rebuild ITK as I don't think the tests were built unless I also included the cmake flag ITK_BUILD_ALL_MODULES. Maybe not. Anyway, I ran the LandmarkWarping test and it reported that it passed. I would be inclined to think that there was something just wrong with my landmarks file if it weren't for the fact that the exact same file produces expected results on an older version.

Seth Parker
Video Editor | The University of Kentucky Vis Center
www.csethparker.com<http://www.csethparker.com> | www.vis.uky.edu<http://www.vis.uky.edu>


On Thu, Nov 21, 2013 at 4:51 PM, Matt McCormick <matt.mccormick at kitware.com<mailto:matt.mccormick at kitware.com>> wrote:
Hi Seth,

To run the test associated with the examples, set

  BUILD_EXAMPLES  ON

in the ITK CMake configuration, build, and run

  ctest -R LandmarkWarping

on the command line in the ITK build directory.

Thanks,
Matt


On Thu, Nov 21, 2013 at 4:20 PM, Seth Parker <csparker247 at gmail.com<mailto:csparker247 at gmail.com>> wrote:
Ok, so a couple of updates. First, I checked and I had tested on Ubuntu 13.04 (Raring Ringtail) and had compiled using GCC 4.7.3. ITK 4.4.0 gave me the same issues with LandmarkWarping2 as on OSX.

On OSX, I had never noticed that Xcode's gcc was using an llvm backend. Clang is supposedly the same way. Also, I've already update all of our computers to OSX 10.9 as we hardly ever do any ITK or development work, so going back to Mountain Lion isn't really an option. However, I did spend today compiling GNU GCC (4.8.2) on my machine and I recompiled ITK 4.4.0 using it instead of Xcode's "GCC". After a successful build, it also exhibits the same issue with LandmarkWarping2. I'm not sure of other variables, but I think it's safe to assume this isn't a compiler issue.

In terms of using the built-in tests, I can find one LandmarkWarping2Test.png under the testing data, but I'm unclear on which of the other images I should register it against (or against it).

Seth Parker
Video Editor | The University of Kentucky Vis Center
www.csethparker.com<http://www.csethparker.com> | www.vis.uky.edu<http://www.vis.uky.edu>


On Wed, Nov 20, 2013 at 9:04 PM, Bradley Lowekamp <brad at lowekamp.net<mailto:brad at lowekamp.net>> wrote:
Hello,

I am just curious if it's a compiler issue or one with the code.

It's been a while since there has been a bonified version of GNU GCC with Xcode. I am running OS 10.8.5, check this out:

$ /usr/bin/gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

That is llvm masquerading as gcc.

There is also clang as an option. I'd give that a try. Upgrading to Macericks is going to another set of problems.

Check out the information here:
http://public.kitware.com/pipermail/community/2013-November/000188.html

This may be a good opportunity to run git-bisect, if the issue can be reproduced.

Brad

On Nov 20, 2013, at 8:57 PM, Seth Parker <csparker247 at gmail.com<mailto:csparker247 at gmail.com>> wrote:


I did try on Ubuntu (Raring Ringtail). It's been a while for Ubuntu, but I believe I used gcc for it. Definitely gcc on OSX. I haven't tried recompiling since upgrading to Mavericks, but I was running Mountain Lion before and Xcode 4.6.

It hadn't occurred to me to check the built-in examples. I should be able to test that tomorrow.

Sent from my phone

On Nov 20, 2013 8:27 PM, "Bradley Lowekamp" <brad at lowekamp.net<mailto:brad at lowekamp.net>> wrote:
Hello,

Have you tried other systems? Linux perhaps?

What compiler are you using? What OS? What XCode version?

Is this issue reproducible with a test or example already in ITK?

Thanks,
Brad

On Nov 20, 2013, at 4:02 PM, Seth Parker <csparker247 at gmail.com<mailto:csparker247 at gmail.com>> wrote:

Was attempting to use ITK-4.4.0 LandmarkWarping2 on OSX and was getting completely incorrect results. The moving image was roughly in the correct spot of the first landmark, but was at a completely incorrect scale. I reverted to 4.3.2 and had no issues at all. I'm fine using 4.3.2, but thought I would mention it here in case anyone has a solution or pointer.

You can download examples of the input and output files here: https://dl.dropboxusercontent.com/u/13015285/LandmarkWarping.zip

Seth Parker
Video Editor | The University of Kentucky Vis Center
www.csethparker.com<http://www.csethparker.com/> | www.vis.uky.edu<http://www.vis.uky.edu/>
_____________________________________
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




_____________________________________
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

_______________________________________________
Community mailing list
Community at itk.org<mailto:Community at itk.org>
http://public.kitware.com/cgi-bin/mailman/listinfo/community





________________________________
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<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





________________________________
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.
________________________________




________________________________
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/20131122/56555465/attachment-0001.htm>


More information about the Insight-users mailing list