MIP from BMP Images [message #76838] |
Wed, 06 July 2011 09:10  |
M R
Messages: 19 Registered: July 2011
|
Junior Member |
|
|
I am fairly new to IDl and trying to learn.
I have a series of 255 bitmap images in a folder.I have to create a
rotating MIP from these images. Each image is of the size 2216 X 1254.
I cannot use read_bmp (as mentioned in IDL Help 8.1 as each line
should be evenly divisible by 4). I am trying to create a 3D array of
the size (3000 X 3000 X 500) in case the image size and number of
images change for each data set. How should I go about addressing this
issue of loading images into IDL? I will be using FOR loop to build
the MIP. I haven't yet thought about rotating the MIP. Any help,
suggestions, advice is greatly appreciated. Thank you!
|
|
|
|
|
Re: MIP from BMP Images [message #76887 is a reply to message #76838] |
Fri, 08 July 2011 10:35   |
M R
Messages: 19 Registered: July 2011
|
Junior Member |
|
|
On Jul 8, 10:41 am, David Fanning <n...@dfanning.com> wrote:
> M R writes:
>> I hope I am making some kind of progress here. I have the following
>> code and I (fortunately) do not get any errors and of course the
>> output is in the form of a blank black pop out screen (I am being too
>> optimistic) and think atleast the program works! Below is the code
>
>> fil = file_search('filepath*.bmp',COUNT = count)
>> imag=read_bmp(fil[0])
>> s=size(imag)
>
>> arm = bytarr (s[1],s[2],count,/nozero)
>
>> for i=0, count-1 do begin
>> image = read_bmp(fil[i])
>> arm[*,*,i]=image[*,*]
>> end
>
>> TV,MAX (arm, dimension = 3)
>
>> end
>
>> (i). imag, arm, image array sizes do not match. They are
>
>> IDL> help, arm
>> ARM BYTE = Array[3, 2216, 256]
>> IDL> help, imag
>> IMAG BYTE = Array[3, 2216, 1254]
>> IDL> help, image
>> IMAGE BYTE = Array[3, 2216, 1254]
>
>> Does anyone feel that this mismatch between the array sizes is
>> creating the blank black pop out screen instead of an image?
>
> Well, yes, among any number of other things. :-)
>
> I say this with all possible kindness, because I can
> see you are making an effort, and I want to help you,
> but if this code actually ran I would say it is because
> you have a special relationship with the programming gods. :-)
>
> How do you know it "ran"? Did you see *any* images
> in the window?
>
> Let's start at the beginning. Can you open and display
> just one of the images in your directory? Just without
> trying to do a loop or anything. At best, with the
> way you are using the TV command (a totally worthless
> command IMHO) you will see a tiny sliver of your image
> on the left-hand side of your display window. If you
> want to use the TV command (a bad idea, as I mentioned),
> you might want to try this:
>
> imageFile = Dialog_Pickfile(FILTER='*.bmp')
> image = Read_BMP(imageFile)
> TV, image, TRUE=1
----------------------------------------------
X--------------------------------------------------------
I have tried the above. The screen does not contain a sliver of the
image but the upper left quadrant of the screen is white while the
reaming 3 quadrants are black. I see a partial axis in the white
quadrant.
-----------------------------------------------
X-------------------------------------------------------
> So, if you want to stuff this 24-bit image into a larger
> array (and I pointed out in a previous article why
> this is almost pointless, since your images don't contain
> any intensity information), then you will have to make
> your array a four-dimensional array:
>
> dims = Size(image, /DIMENSIONS)
> arms = Make_Array(dims[0], dims[1], dims[2], count, /BYTE)
>
> Then,
>
> arms[*,*,*,j] = image
-----------------------------------------------
X-------------------------------------------------
The images contain intensity information. First because different
kinds of tissues are seen clearly. Secondly (My feeling), each image
of the size 24 bit in its color.
-----------------------------------------
X-----------------------------------------------------
> This, of course, assumes all your images are the same size.
>
> I suspect this program of yours ran, maybe, one time
> and with errors you aren't aware of. Do you have
> your IDL console window somewhere where you can see
> it easily?
>
-------------------------
X---------------------------------------------
Yes, I do have an IDL console window where I cross check each variable
--------------------------
X--------------------------------------------
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thue. ("Perhaps thos speakest truth.")
----------------------------X------------------------------- ----
As you have suggested,I think I will try to display just one image
without the loop and see if it is being displayed entirely or not.
Thank you!
----------------------------X------------------------------- --
|
|
|
Re: MIP from BMP Images [message #76889 is a reply to message #76838] |
Fri, 08 July 2011 11:25   |
M R
Messages: 19 Registered: July 2011
|
Junior Member |
|
|
On Jul 8, 10:41 am, David Fanning <n...@dfanning.com> wrote:
> M R writes:
>> I hope I am making some kind of progress here. I have the following
>> code and I (fortunately) do not get any errors and of course the
>> output is in the form of a blank black pop out screen (I am being too
>> optimistic) and think atleast the program works! Below is the code
>
>> fil = file_search('filepath*.bmp',COUNT = count)
>> imag=read_bmp(fil[0])
>> s=size(imag)
>
>> arm = bytarr (s[1],s[2],count,/nozero)
>
>> for i=0, count-1 do begin
>> image = read_bmp(fil[i])
>> arm[*,*,i]=image[*,*]
>> end
>
>> TV,MAX (arm, dimension = 3)
>
>> end
>
>> (i). imag, arm, image array sizes do not match. They are
>
>> IDL> help, arm
>> ARM BYTE = Array[3, 2216, 256]
>> IDL> help, imag
>> IMAG BYTE = Array[3, 2216, 1254]
>> IDL> help, image
>> IMAGE BYTE = Array[3, 2216, 1254]
>
>> Does anyone feel that this mismatch between the array sizes is
>> creating the blank black pop out screen instead of an image?
>
> Well, yes, among any number of other things. :-)
>
> I say this with all possible kindness, because I can
> see you are making an effort, and I want to help you,
> but if this code actually ran I would say it is because
> you have a special relationship with the programming gods. :-)
>
> How do you know it "ran"? Did you see *any* images
> in the window?
>
> Let's start at the beginning. Can you open and display
> just one of the images in your directory? Just without
> trying to do a loop or anything. At best, with the
> way you are using the TV command (a totally worthless
> command IMHO) you will see a tiny sliver of your image
> on the left-hand side of your display window. If you
> want to use the TV command (a bad idea, as I mentioned),
> you might want to try this:
>
> imageFile = Dialog_Pickfile(FILTER='*.bmp')
> image = Read_BMP(imageFile)
> TV, image, TRUE=1
--------------------------------------
X----------------------------------------------
Using the above mentioned imagefile.......steps, I can see a pop up
window which does not contain a sliver of the image but the upper left
hand corner is white with the remaining three quadrants black.
----------------------------------------------
X--------------------------------------------
> So, if you want to stuff this 24-bit image into a larger
> array (and I pointed out in a previous article why
> this is almost pointless, since your images don't contain
> any intensity information), then you will have to make
> your array a four-dimensional array:
>
> dims = Size(image, /DIMENSIONS)
> arms = Make_Array(dims[0], dims[1], dims[2], count, /BYTE)
>
> Then,
>
> arms[*,*,*,j] = image
>
> This, of course, assumes all your images are the same size.
>
> I suspect this program of yours ran, maybe, one time
> and with errors you aren't aware of. Do you have
> your IDL console window somewhere where you can see
> it easily?
>
------------------------------X----------------------------- -
I do an IDL console window where I am cross checking the variables and
the values being loaded.
The images do contain intensity information. First, I can
differentiate between the different tissues. Second, each image is 24
bit size.
------------------------------X--------------------------
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thue. ("Perhaps thos speakest truth.")
------------------------X--------------------------
I will try with one image first and then see if I can output the same.
Thank you!
----------------------X-------------------------------
|
|
|
Re: MIP from BMP Images [message #76895 is a reply to message #76838] |
Fri, 08 July 2011 08:52   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> Let's start at the beginning. Can you open and display
> just one of the images in your directory? Just without
> trying to do a loop or anything. At best, with the
> way you are using the TV command (a totally worthless
> command IMHO) you will see a tiny sliver of your image
> on the left-hand side of your display window. If you
> want to use the TV command (a bad idea, as I mentioned),
> you might want to try this:
>
> imageFile = Dialog_Pickfile(FILTER='*.bmp')
> image = Read_BMP(imageFile)
> TV, image, TRUE=1
By the way, you don't say how big your display
window is, but I doubt it is 2216 by 1254 pixels
in size. So, when you use this TV command, you
are probably only going to see a small fraction
of your image anyway.
You might be better off downloading the Coyote
Library and using the cgImage command:
cgImage, image, /KEEP_ASPECT
That will at least show you the entire image
in your graphics window.
You can find the Coyote Library here:
http://www.idlcoyote.com/code_tips/installcoyote.php
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|
Re: MIP from BMP Images [message #76897 is a reply to message #76838] |
Fri, 08 July 2011 08:41   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
M R writes:
> I hope I am making some kind of progress here. I have the following
> code and I (fortunately) do not get any errors and of course the
> output is in the form of a blank black pop out screen (I am being too
> optimistic) and think atleast the program works! Below is the code
>
> fil = file_search('filepath*.bmp',COUNT = count)
> imag=read_bmp(fil[0])
> s=size(imag)
>
> arm = bytarr (s[1],s[2],count,/nozero)
>
> for i=0, count-1 do begin
> image = read_bmp(fil[i])
> arm[*,*,i]=image[*,*]
> end
>
> TV,MAX (arm, dimension = 3)
>
> end
>
> (i). imag, arm, image array sizes do not match. They are
>
> IDL> help, arm
> ARM BYTE = Array[3, 2216, 256]
> IDL> help, imag
> IMAG BYTE = Array[3, 2216, 1254]
> IDL> help, image
> IMAGE BYTE = Array[3, 2216, 1254]
>
> Does anyone feel that this mismatch between the array sizes is
> creating the blank black pop out screen instead of an image?
Well, yes, among any number of other things. :-)
I say this with all possible kindness, because I can
see you are making an effort, and I want to help you,
but if this code actually ran I would say it is because
you have a special relationship with the programming gods. :-)
How do you know it "ran"? Did you see *any* images
in the window?
Let's start at the beginning. Can you open and display
just one of the images in your directory? Just without
trying to do a loop or anything. At best, with the
way you are using the TV command (a totally worthless
command IMHO) you will see a tiny sliver of your image
on the left-hand side of your display window. If you
want to use the TV command (a bad idea, as I mentioned),
you might want to try this:
imageFile = Dialog_Pickfile(FILTER='*.bmp')
image = Read_BMP(imageFile)
TV, image, TRUE=1
So, if you want to stuff this 24-bit image into a larger
array (and I pointed out in a previous article why
this is almost pointless, since your images don't contain
any intensity information), then you will have to make
your array a four-dimensional array:
dims = Size(image, /DIMENSIONS)
arms = Make_Array(dims[0], dims[1], dims[2], count, /BYTE)
Then,
arms[*,*,*,j] = image
This, of course, assumes all your images are the same size.
I suspect this program of yours ran, maybe, one time
and with errors you aren't aware of. Do you have
your IDL console window somewhere where you can see
it easily?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|
|
|
|
Re: MIP from BMP Images [message #76931 is a reply to message #76838] |
Thu, 14 July 2011 07:06   |
M R
Messages: 19 Registered: July 2011
|
Junior Member |
|
|
On Jul 13, 2:14 pm, Dick Jackson <d...@d-jackson.com> wrote:
> On Jul 13, 10:03 am, M <manishared...@gmail.com> wrote:
>
>> On Jul 13, 10:57 am, M R <manisha....@gmail.com> wrote:
>
>>> I apologize for the multiple postings.
>>> Regarding the image intensity, will the problem be solved if I use
>>> colored images?
>
> Hi,
>
> I'm still confused about whether these are grayscale, indexed or true-
> colour RGB images, but here's a tip if all you need is to get the
> maximum value from each pixel of a large set of images, where you
> can't fit them all in memory. Building on your last example:
>
> fil = file_search('filepath\*.bmp',COUNT = count)
> result = read_bmp(fil[0]) ; Start with image from fil[0], don't
> need to read it again
> for i=1, count-1 do result = result > read_bmp(fil[i])
> TV, result
>
> end
>
> Cheers,
> -Dick
Hello All
I thank you all for helping me out with this problem. Unfortunately
since IDL supports only 1GB data at a time, we have decided not use
the existing data set (which is at >2GB). But I will definitely come
back here for more help. Thank you once again!
|
|
|
Re: MIP from BMP Images [message #76938 is a reply to message #76838] |
Wed, 13 July 2011 12:14   |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
On Jul 13, 10:03 am, M <manishared...@gmail.com> wrote:
> On Jul 13, 10:57 am, M R <manisha....@gmail.com> wrote:
>
>> I apologize for the multiple postings.
>> Regarding the image intensity, will the problem be solved if I use
>> colored images?
Hi,
I'm still confused about whether these are grayscale, indexed or true-
colour RGB images, but here's a tip if all you need is to get the
maximum value from each pixel of a large set of images, where you
can't fit them all in memory. Building on your last example:
fil = file_search('filepath\*.bmp',COUNT = count)
result = read_bmp(fil[0]) ; Start with image from fil[0], don't
need to read it again
for i=1, count-1 do result = result > read_bmp(fil[i])
TV, result
end
Cheers,
-Dick
|
|
|
Re: MIP from BMP Images [message #76939 is a reply to message #76838] |
Wed, 13 July 2011 10:47   |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Jul 13, 2:03 pm, M <manishared...@gmail.com> wrote:
>> Regarding the image intensity, will the problem be solved if I use
>> colored images?
I do not know what you mean there. David was saying that a problem is
that these images seem to be RGB, thus probably their values are not
intensities, but colors derived from a single channel image (the
intensities) mapped through a colortable.
>
> And thirdly, when I have tried the following,
>
> fil = file_search('filepath\*.bmp',COUNT = count)
> imag=read_bmp(fil[0])
> dims=size(imag, /DIMENSIONS)
> arms = make_array(dims[0],dims[1],dims[2],count,/byte)
>
> for i=0, count-1 do begin
> image = read_bmp(fil[i])
> arm[*,*,*,i]=image
> end
>
> TV,MAX (arm, dimension = 3)
>
> end
>
> The output is
> Unable to allocate memory: to make array.
> Not enough space
That is simple. The array arm would be too big to fit in memory. If
you have RGB images with 2216x1254x3 bytes, each is just short of 8MB,
so probably a few hundred of those would be enough to fill your
available memory.
|
|
|
Re: MIP from BMP Images [message #76941 is a reply to message #76838] |
Wed, 13 July 2011 10:03   |
M
Messages: 3 Registered: July 2011
|
Junior Member |
|
|
On Jul 13, 10:57 am, M R <manisha....@gmail.com> wrote:
> On Jul 13, 10:34 am, M R <manisha....@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>> On Jul 8, 4:23 pm, Konstantinos <moonlightsha...@hotmail.gr> wrote:
>
>>> Dear M R.
>
>>> I will suggest you the folowing
>
>>> READ a book about image processing.
>
>>> Image processing the fundamentals (petrou)
>>> An also very nice book is
>>> The Image Processing Handbook, Sixth Edition
>
>>> Probably you think where can i find theese books?? Try ebookee.com
>
>> Thank you for suggesting the books Konstantinos.I will go through
>> them.
>
>> David, I have the following
>
>> As you have mentioned, I do see a tiny sliver of the images in the
>> upper left quadrant of the display window. Surprisingly, the program
>> is running multiple times and gives the same output without any
>> compilation errors.
>
>> When I load a single image (.png, 2216 X 1254 resolution) using the
>> following procedure,
>> imageFIle = dialog_Pickfile(filter='*.png')
>> image = read_image(imagefile)
>> tv,image,TRUE=1
>> end
>
>> I see an output in the display window containing the bottom 70 % of
>> the image.
>
>> Any suggestions? Thank you.
>
> I apologize for the multiple postings.
> Regarding the image intensity, will the problem be solved if I use
> colored images?
And thirdly, when I have tried the following,
fil = file_search('filepath\*.bmp',COUNT = count)
imag=read_bmp(fil[0])
dims=size(imag, /DIMENSIONS)
arms = make_array(dims[0],dims[1],dims[2],count,/byte)
for i=0, count-1 do begin
image = read_bmp(fil[i])
arm[*,*,*,i]=image
end
TV,MAX (arm, dimension = 3)
end
The output is
Unable to allocate memory: to make array.
Not enough space
|
|
|
Re: MIP from BMP Images [message #76944 is a reply to message #76838] |
Wed, 13 July 2011 08:57   |
M R
Messages: 19 Registered: July 2011
|
Junior Member |
|
|
On Jul 13, 10:34 am, M R <manisha....@gmail.com> wrote:
> On Jul 8, 4:23 pm, Konstantinos <moonlightsha...@hotmail.gr> wrote:
>
>> Dear M R.
>
>> I will suggest you the folowing
>
>> READ a book about image processing.
>
>> Image processing the fundamentals (petrou)
>> An also very nice book is
>> The Image Processing Handbook, Sixth Edition
>
>> Probably you think where can i find theese books?? Try ebookee.com
>
> Thank you for suggesting the books Konstantinos.I will go through
> them.
>
> David, I have the following
>
> As you have mentioned, I do see a tiny sliver of the images in the
> upper left quadrant of the display window. Surprisingly, the program
> is running multiple times and gives the same output without any
> compilation errors.
>
> When I load a single image (.png, 2216 X 1254 resolution) using the
> following procedure,
> imageFIle = dialog_Pickfile(filter='*.png')
> image = read_image(imagefile)
> tv,image,TRUE=1
> end
>
> I see an output in the display window containing the bottom 70 % of
> the image.
>
> Any suggestions? Thank you.
I apologize for the multiple postings.
Regarding the image intensity, will the problem be solved if I use
colored images?
|
|
|
Re: MIP from BMP Images [message #76946 is a reply to message #76881] |
Wed, 13 July 2011 08:34   |
M R
Messages: 19 Registered: July 2011
|
Junior Member |
|
|
On Jul 8, 4:23 pm, Konstantinos <moonlightsha...@hotmail.gr> wrote:
> Dear M R.
>
> I will suggest you the folowing
>
> READ a book about image processing.
>
> Image processing the fundamentals (petrou)
> An also very nice book is
> The Image Processing Handbook, Sixth Edition
>
> Probably you think where can i find theese books?? Try ebookee.com
Thank you for suggesting the books Konstantinos.I will go through
them.
David, I have the following
As you have mentioned, I do see a tiny sliver of the images in the
upper left quadrant of the display window. Surprisingly, the program
is running multiple times and gives the same output without any
compilation errors.
When I load a single image (.png, 2216 X 1254 resolution) using the
following procedure,
imageFIle = dialog_Pickfile(filter='*.png')
image = read_image(imagefile)
tv,image,TRUE=1
end
I see an output in the display window containing the bottom 70 % of
the image.
Any suggestions? Thank you.
|
|
|
Re: MIP from BMP Images [message #76969 is a reply to message #76946] |
Wed, 20 July 2011 12:15  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
M R writes:
> David, I have the following
>
> As you have mentioned, I do see a tiny sliver of the images in the
> upper left quadrant of the display window. Surprisingly, the program
> is running multiple times and gives the same output without any
> compilation errors.
>
> When I load a single image (.png, 2216 X 1254 resolution) using the
> following procedure,
> imageFIle = dialog_Pickfile(filter='*.png')
> image = read_image(imagefile)
> tv,image,TRUE=1
> end
>
> I see an output in the display window containing the bottom 70 % of
> the image.
>
> Any suggestions?
Yes, cgImage, as I think I have mentioned on one or two
occasions. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|