Hello,
Matlab's imresize and FloatProcessor's resize functions are giving different results when both are using bilinear interpolation [I didn't try the other interpolation methods for comparison]. What could be causing this? Are they supposed to be different? I went through the IJ source code, but I could not do the same in matlab [since I got stuck in tformarray.m]. For your reference, I am shortly writing down what I am doing: In Java, *for(k=0;k<stackSize;k++) { ImageProcessor ip = imp.getStack().getProcessor(k+1); ip.setInterpolationMethod(ImageProcessor.BILINEAR); ip = ip.resize(128, 128); stack.addSlice("NewImage", ip); } * In Matlab, *for k = 1:numberOfSlices NewImage(:,:,k) = imresize(squeeze(originalImage(:,:,k)),[128 128],'bilinear'); end* I would appreciate any comments. Thank you very much. |
Hi,
even if there is ONE algorithm, implementation details might cause slight differences.... What kind of differences do you see? What size of difference? Can you post an example somewhere? I assume you use FloatProcessor in ImageJ? On Matlab, what is the image data type? I could also imagine this depends WHERE exactly the pixel contents is assumed to be located, in the center of a "pixel box" or in some edge. This offset normally makes no difference when reading/writing unscaled data, but might make a difference when resizing by a (noninteger?) factor!???? Just my 0,02$ (or 0.02€) Sincerely Joachim Wesner Cihat Eldeniz <cihat.eldeniz@GM AIL.COM> An Gesendet von: [hidden email] ImageJ Interest Kopie Group <[hidden email]. Thema GOV> Matlab's imresize 10.09.2009 15:40 Bitte antworten an ImageJ Interest Group <[hidden email]. GOV> Hello, Matlab's imresize and FloatProcessor's resize functions are giving different results when both are using bilinear interpolation [I didn't try the other interpolation methods for comparison]. What could be causing this? Are they supposed to be different? I went through the IJ source code, but I could not do the same in matlab [since I got stuck in tformarray.m]. For your reference, I am shortly writing down what I am doing: In Java, *for(k=0;k<stackSize;k++) { ImageProcessor ip = imp.getStack().getProcessor(k+1); ip.setInterpolationMethod(ImageProcessor.BILINEAR); ip = ip.resize(128, 128); stack.addSlice("NewImage", ip); } * In Matlab, *for k = 1:numberOfSlices NewImage(:,:,k) = imresize(squeeze(originalImage(:,:,k)),[128 128],'bilinear'); end* I would appreciate any comments. Thank you very much. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
Thank you very much.
It is an image of a brain slice. The data range is from 0 to 1000. The slice is located in the middle of the image. The difference between the two is amplified at the boundaries which are of high intensity. You can find all the three images through the following links: http://www.largefilesasap.com/cupload/94aef96f94b3cbf51c0097e85b21788a/difference.jpg http://www.largefilesasap.com/cupload/94aef96f94b3cbf51c0097e85b21788a/matlab.jpg http://www.largefilesasap.com/cupload/94aef96f94b3cbf51c0097e85b21788a/imagej.jpg By the way, we accept Turkish Kurush only [0.02 Turkish Liras]. :)) Many thanks. 2009/9/10 Joachim Wesner <[hidden email]> > Hi, > > even if there is ONE algorithm, implementation details might cause slight > differences.... > > What kind of differences do you see? What size of difference? Can you post > an example somewhere? > > I assume you use FloatProcessor in ImageJ? On Matlab, what is the image > data type? > > I could also imagine this depends WHERE exactly the pixel contents is > assumed to be located, > in the center of a "pixel box" or in some edge. This offset normally makes > no difference when reading/writing > unscaled data, but might make a difference when resizing by a > (noninteger?) factor!???? > > Just my 0,02$ (or 0.02€) > > Sincerely > > Joachim Wesner > > > > > > Cihat Eldeniz > <cihat.eldeniz@GM > AIL.COM> An > Gesendet von: [hidden email] > ImageJ Interest Kopie > Group > <[hidden email]. Thema > GOV> Matlab's imresize > > > 10.09.2009 15:40 > > > Bitte antworten > an > ImageJ Interest > Group > <[hidden email]. > GOV> > > > > > > > Hello, > > Matlab's imresize and FloatProcessor's resize functions are giving > different > results when both are using bilinear interpolation [I didn't try the other > interpolation methods for comparison]. > > What could be causing this? Are they supposed to be different? I went > through the IJ source code, but I could not do the same in matlab [since I > got stuck in tformarray.m]. > > For your reference, I am shortly writing down what I am doing: > > In Java, > > *for(k=0;k<stackSize;k++) > { > ImageProcessor ip = imp.getStack().getProcessor(k+1); > ip.setInterpolationMethod(ImageProcessor.BILINEAR); > ip = ip.resize(128, 128); > stack.addSlice("NewImage", ip); > } > * > In Matlab, > > *for k = 1:numberOfSlices > NewImage(:,:,k) = imresize(squeeze(originalImage(:,:,k)),[128 > 128],'bilinear'); > end* > > I would appreciate any comments. Thank you very much. > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > |
Dear Cihat,
the ImageJ image in your example collection is not 128x128px large. That is, the most apparent difference comes from the fact that both images differ in resolution. Best, Stephan On Thu, 2009-09-10 at 10:14 -0400, Cihat Eldeniz wrote: > Thank you very much. > > It is an image of a brain slice. The data range is from 0 to 1000. The slice > is located in the middle of the image. The difference between the two is > amplified at the boundaries which are of high intensity. You can find all > the three images through the following links: > > http://www.largefilesasap.com/cupload/94aef96f94b3cbf51c0097e85b21788a/difference.jpg > > http://www.largefilesasap.com/cupload/94aef96f94b3cbf51c0097e85b21788a/matlab.jpg > > http://www.largefilesasap.com/cupload/94aef96f94b3cbf51c0097e85b21788a/imagej.jpg > > By the way, we accept Turkish Kurush only [0.02 Turkish Liras]. :)) > > Many thanks. > > > 2009/9/10 Joachim Wesner <[hidden email]> > > > Hi, > > > > even if there is ONE algorithm, implementation details might cause slight > > differences.... > > > > What kind of differences do you see? What size of difference? Can you post > > an example somewhere? > > > > I assume you use FloatProcessor in ImageJ? On Matlab, what is the image > > data type? > > > > I could also imagine this depends WHERE exactly the pixel contents is > > assumed to be located, > > in the center of a "pixel box" or in some edge. This offset normally makes > > no difference when reading/writing > > unscaled data, but might make a difference when resizing by a > > (noninteger?) factor!???? > > > > Just my 0,02$ (or 0.02€) > > > > Sincerely > > > > Joachim Wesner > > > > > > > > > > > > Cihat Eldeniz > > <cihat.eldeniz@GM > > AIL.COM> An > > Gesendet von: [hidden email] > > ImageJ Interest Kopie > > Group > > <[hidden email]. Thema > > GOV> Matlab's imresize > > > > > > 10.09.2009 15:40 > > > > > > Bitte antworten > > an > > ImageJ Interest > > Group > > <[hidden email]. > > GOV> > > > > > > > > > > > > > > Hello, > > > > Matlab's imresize and FloatProcessor's resize functions are giving > > different > > results when both are using bilinear interpolation [I didn't try the other > > interpolation methods for comparison]. > > > > What could be causing this? Are they supposed to be different? I went > > through the IJ source code, but I could not do the same in matlab [since I > > got stuck in tformarray.m]. > > > > For your reference, I am shortly writing down what I am doing: > > > > In Java, > > > > *for(k=0;k<stackSize;k++) > > { > > ImageProcessor ip = imp.getStack().getProcessor(k+1); > > ip.setInterpolationMethod(ImageProcessor.BILINEAR); > > ip = ip.resize(128, 128); > > stack.addSlice("NewImage", ip); > > } > > * > > In Matlab, > > > > *for k = 1:numberOfSlices > > NewImage(:,:,k) = imresize(squeeze(originalImage(:,:,k)),[128 > > 128],'bilinear'); > > end* > > > > I would appreciate any comments. Thank you very much. > > > > ______________________________________________________________________ > > This email has been scanned by the MessageLabs Email Security System. > > For more information please visit http://www.messagelabs.com/email > > ______________________________________________________________________ > > |
Free forum by Nabble | Edit this page |