[Insight-users] problems with image resize (resample with interpolation and affine transform)

Luis Ibanez luis.ibanez at kitware.com
Wed Feb 17 16:59:32 EST 2010


Hi Darren,

Thanks for the clarification,
I see now the input TIFF images in the subdirectory

                testResize/w1/bw/


When I run the script

               testResize.bash

I get the following output:

----------------------------- begin output ----------------------------

input image file path    : ./testResize/w1/bw/
input image file regex   : section([0-9][0-9][0-9][0-9]).*[.]tif
sort regex subexpression : 1
output image file path   : data/
output image file type   : tif

Files to process (sorted):
./testResize/w1/bw//section0003_w1.tif
./testResize/w1/bw//section0004_w1.tif
./testResize/w1/bw//section0005_w1.tif
./testResize/w1/bw//section0006_w1.tif
./testResize/w1/bw//section0007_w1.tif


Img size    : [732, 716]
Img origin  : [0, 0]
Img spacing : [0.0552832, 0.0552832]
Img direction :
1 0
0 1



Writing 2D image: data/section0003_w1.tif
Writing 2D image: data/section0004_w1.tif
Writing 2D image: data/section0005_w1.tif
Writing 2D image: data/section0006_w1.tif
Writing 2D image: data/section0007_w1.tif

---------------------- end of output -----------------

As you pointed out, the TIFF images in the
testResize/w1/bw/     directory do not seem
to be well formated. They are not read correctly
by the itkTIFFImageIO.

---

Then, I changed "imageType" to "png" in
your script, and now I see the output  PNG
images being saturated.


With this input, the output files are still saturated.

The problem seems to be unrelated to the
resampling, and rather to be connected to an
error in the process of reading the PNG files.

When I run your code in a Linux 64 bits machine,
and connect a MinimumMaximumImageCalculator
to the output of the reader, I got the following
maximum and minimum values for you input PNG
files:

MINIMUM = 0
MAXIMUM = 3.68641e+09
MINIMUM = 0
MAXIMUM = 3.54184e+09
MINIMUM = 0
MAXIMUM = 3.31024e+09
MINIMUM = 0
MAXIMUM = 3.3257e+09
MINIMUM = 0
MAXIMUM = 3.33396e+09


I'm now tracking the problem at the
reader level....


      Luis


--------------------------------------------------------
On Mon, Feb 15, 2010 at 6:54 PM, Darren Weber
<darren.weber.lists at gmail.com> wrote:
>
> Hi Luis,
> Thank you for looking at this.  There's no secrets to hide in my code and
> I'm glad it compiles on another system ;-).
> In the download .tgz file, there are tiff files in:
> testResize/w1/bw/section*_w1.tif
> ftp://anonymous@ftp.buckinstitute.org/dweber/testResize.tgz
>
> I have ITK 3.16.0 through MacPorts.  There might have been some changes in
> the dylib links.  So I did a full MacPorts update/upgrade and then re-built
> and installed ITK.  I still get some bugs with these tiff files.  They were
> created using ImageMagick convert from the .png files (using no options to
> convert).  The port system reports the following install for ImageMagick
> ImageMagick @6.5.9-0_0+q16 (active)
>
> Take care,
> Darren
>
>
>
> On Mon, Feb 15, 2010 at 2:23 PM, Luis Ibanez <luis.ibanez at kitware.com>
> wrote:
>>
>> Hi Darren,
>>
>> Thanks for posting the full source code.
>>
>> I manage to build it (after installing Boost), and got to the point
>> where I needed one of the original TIFF images in order to
>> test the code. Can you post one ?
>>
>> Looking at the source code, the only thing that I found suspicious
>> is the use of NumericTraits::max() in the definition of the default
>> pixel value for the resampler.
>>
>> These intensity rescaling shouldn't be happening with the
>> classes that you are using.
>>
>> There may be something particular about your input TIFF
>> images....
>>
>>
>>      Regards,
>>
>>
>>            Luis
>>
>>
>>
>> ---------------------------------------------------------------------------------------------
>> On Fri, Feb 12, 2010 at 5:19 PM, Darren Weber
>> <darren.weber.lists at gmail.com> wrote:
>> >
>> > Hi,
>> > A program that was working with ITK 3.14 is not working with 3.16 (on
>> > OSX).
>> >  It's a mystery to me.
>> > The program takes a list of image files (regex input), scans them all
>> > for
>> > the largest image dimensions (2D), then "converts" or resamples all the
>> > images in the series into the same dimensions.
>> > The conversion process involves an information filter and a reslicer.
>> >  The
>> > latter includes an affine transform (just a translation to center the
>> > images) and an interpolator.
>> > The outputs fail to replicate the intensity scale of the inputs.  Also,
>> > the
>> > outputs are wildly different for .png and .tif inputs.
>> > All the code and example files are available for download (as of Feb
>> > 2010)
>> > ftp://anonymous@ftp.buckinstitute.org/dweber/testResize.tgz
>> > In that archive, the source code and a build are in testResizeCode, the
>> > input data files are in testResize/w1/bw/ and the outputs are in
>> > testResize/w1/bw_resize.  There is a script, testResize.bash, to run the
>> > example - it has a variable for image type (png or tif).  The output
>> > files
>> > are wildly different for the png and tif inputs.
>> > BTW, the purpose of this image resize process is to provide a series of
>> > images with the same dimensions for registration.  Is it true that a
>> > registration process for any two images must have images of the same
>> > dimensions?
>> > Take care,
>> > Darren
>> >
>> > _____________________________________
>> > 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://www.kitware.com/products/protraining.html
>> >
>> > 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
>> >
>> >
>
>


More information about the Insight-users mailing list