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