comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Calculate median of stacks of images using IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Calculate median of stacks of images using IDL [message #88710 is a reply to message #88708] Mon, 09 June 2014 04:18 Go to previous messageGo to previous message
dg86 is currently offline  dg86
Messages: 118
Registered: September 2012
Senior Member
On Saturday, June 7, 2014 6:42:04 PM UTC-4, David Grier wrote:
> On Friday, June 6, 2014 4:46:37 PM UTC-4, Nitsorn Wongsajjathiti wrote:
>
>> Hi,
>
>>
>
>> I am trying to compute a median of a stack of images in TIF format for my research. From another source I found out a way to compute this from stack of images present in a GDF format, using
>
>>
>
>>
>
>>
>
>> IDL> buf=read_gdf('demo.gdf')
>
>>
>
>> IDL> help, buf
>
>>
>
>> BUF FLOAT = Array[640, 480, 100]
>
>>
>
>> IDL>b=median(buf,/double,dimension=3)
>
>>
>
>>
>
>>
>
>> However, I am having difficulty converting my TIF images into GDF, but still need to normalize my images somehow. Any suggestions on how to do so?
>
>>
>
>> Thank you in advance. Any help will be highly appreciated!
>
>>
>
>> Nitsorn Wongsajjathiti
>
>
>
> Hi Again,
>
>
>
> You can use READ_IMAGE to read in your images, then stack them up, and take the median.
>
>
>
> filenames = file_search("my_filename_regex*.tif")
>
> buf = []
>
> for f in filenames do $
>
> buf = [[[buf]], [[read_image(f)]]]
>
>
>
> b = median(buf, /double, dimension=3)
>
>
>
> TTFN,
>
>
>
> David

I was trying to avoid having to figure out the dimensions of the images. Here's a more general version:

buf = list()
for f in file_search("mynames*.tif") do $
buf.add, read_image(f)
b = median(buf.toarray(), /double, dimension=1)

This works for grayscale and color images, regardless of the pixel ordering.

TTFN,

David
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to use SPAWN for creating multiple output files?
Next Topic: IDLdoc 3.6.0 released

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 10:17:15 PDT 2025

Total time taken to generate the page: 0.96137 seconds