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

Home » Public Forums » archive » Re: problem with writing a 2D image .tiff
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: problem with writing a 2D image .tiff [message #53497] Wed, 18 April 2007 07:07 Go to next message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Apr 18, 7:54 am, "aleks.fra...@gmail.com" <aleks.fra...@gmail.com>
wrote:
> Hy
> My code reads a 2D tiff image and I create a colortable with 6 levels.
> It works fine, and I can visualize the result image, but I'm having a
> hard time trying to write the image to my computer.
>
> ;Code:
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> image = read_tiff('myImagePath\myImage.tiff'))
>
> device, decompose = 0
>
> colorLevels = [ [0 , 0 , 0 ], $
> [0 , 0 , 255], $
> [51 , 194, 255], $
> [182, 255, 143], $
> [255, 200, 0 ], $
> [255, 0 , 0 ] ]
>
> numOfLevel = CEIL(!D.TABLE_SIZE/6.)
> level = INDGEN(!D.TABLE_SIZE)/numOfLevel
>
> newRed = colorLevels[0, Nivel]
> newGreen = colorLevels[1, Nivel]
> newBlue = colorLevels[2, Nivel]
>
> TVLCT, newRed, newGreen, newBlue
>
> x = 900
> y = 600
>
> ;;Visualize result image
> image = CONGRID(image, x, y)
>
> WINDOW, 0, xSize = x, ySize = y
>
> TVSCL, image, /order
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> This first part works fine. The problem is below, when I try to write
> the result image
>
> ;;;;;;;;
> ;;;;;;;;using write_tif
> ;;;;;;;;
> ;;_______TIF
> newRed = reform(newRed)
> newGreen = reform(newGreen)
> newBlue = reform(newBlue)
>
> Write_tiff, 'C:\IDL\tests\mytif.tif', image, $
> RED=newred,GREEN=newgreen,BLUE=newblue
> ;;;;;;;;
> ;;;;;;;;I've also tried using write_Jpeg
> ;;;;;;;;
> ;_______JPEG
> array = bytarr(3,x,y)
> array[0,*,*] = newred[image]
> array[1,*,*] = newgreen[image]
> array[2,*,*] = newblue[image]
>
> Write_jpeg, 'C:\IDL\tests\myimage.jpg',array, TRUE = 1
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;
>
> Does anyone have any idea whats wrong? I'm sure its very easy problem
> to treat, but I'm stuck on this problem for 1 week.
>
> Thank you
> Aleksander

So what is "the problem"? What goes wrong?
Re: problem with writing a 2D image .tiff [message #53499 is a reply to message #53497] Wed, 18 April 2007 06:52 Go to previous messageGo to next message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Apr 18, 7:54 am, "aleks.fra...@gmail.com" <aleks.fra...@gmail.com>
wrote:
> Hy
> My code reads a 2D tiff image and I create a colortable with 6 levels.
> It works fine, and I can visualize the result image, but I'm having a
> hard time trying to write the image to my computer.
>
> ;Code:
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> image = read_tiff('myImagePath\myImage.tiff'))
>
> device, decompose = 0
>
> colorLevels = [ [0 , 0 , 0 ], $
> [0 , 0 , 255], $
> [51 , 194, 255], $
> [182, 255, 143], $
> [255, 200, 0 ], $
> [255, 0 , 0 ] ]
>
> numOfLevel = CEIL(!D.TABLE_SIZE/6.)
> level = INDGEN(!D.TABLE_SIZE)/numOfLevel
>
> newRed = colorLevels[0, Nivel]
> newGreen = colorLevels[1, Nivel]
> newBlue = colorLevels[2, Nivel]
>
> TVLCT, newRed, newGreen, newBlue
>
> x = 900
> y = 600
>
> ;;Visualize result image
> image = CONGRID(image, x, y)
>
> WINDOW, 0, xSize = x, ySize = y
>
> TVSCL, image, /order
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> This first part works fine. The problem is below, when I try to write
> the result image
>
> ;;;;;;;;
> ;;;;;;;;using write_tif
> ;;;;;;;;
> ;;_______TIF
> newRed = reform(newRed)
> newGreen = reform(newGreen)
> newBlue = reform(newBlue)
>
> Write_tiff, 'C:\IDL\tests\mytif.tif', image, $
> RED=newred,GREEN=newgreen,BLUE=newblue
> ;;;;;;;;
> ;;;;;;;;I've also tried using write_Jpeg
> ;;;;;;;;
> ;_______JPEG
> array = bytarr(3,x,y)
> array[0,*,*] = newred[image]
> array[1,*,*] = newgreen[image]
> array[2,*,*] = newblue[image]
>
> Write_jpeg, 'C:\IDL\tests\myimage.jpg',array, TRUE = 1
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;
>
> Does anyone have any idea whats wrong? I'm sure its very easy problem
> to treat, but I'm stuck on this problem for 1 week.
>
> Thank you
> Aleksander

So what happens? What's "the problem"?
Re: problem with writing a 2D image .tiff [message #53573 is a reply to message #53497] Wed, 18 April 2007 18:03 Go to previous message
aleks.franca@gmail.co is currently offline  aleks.franca@gmail.co
Messages: 33
Registered: March 2007
Member
On 18 abr, 11:07, hradilv <hrad...@yahoo.com> wrote:
> On Apr 18, 7:54 am, "aleks.fra...@gmail.com" <aleks.fra...@gmail.com>
> wrote:
>
>
>
>> Hy
>> My code reads a 2D tiff image and I create a colortable with 6 levels.
>> It works fine, and I can visualize the result image, but I'm having a
>> hard time trying to write the image to my computer.
>
>> ;Code:
>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>> image = read_tiff('myImagePath\myImage.tiff'))
>
>> device, decompose = 0
>
>> colorLevels = [ [0 , 0 , 0 ], $
>> [0 , 0 , 255], $
>> [51 , 194, 255], $
>> [182, 255, 143], $
>> [255, 200, 0 ], $
>> [255, 0 , 0 ] ]
>
>> numOfLevel = CEIL(!D.TABLE_SIZE/6.)
>> level = INDGEN(!D.TABLE_SIZE)/numOfLevel
>
>> newRed = colorLevels[0, Nivel]
>> newGreen = colorLevels[1, Nivel]
>> newBlue = colorLevels[2, Nivel]
>
>> TVLCT, newRed, newGreen, newBlue
>
>> x = 900
>> y = 600
>
>> ;;Visualize result image
>> image = CONGRID(image, x, y)
>
>> WINDOW, 0, xSize = x, ySize = y
>
>> TVSCL, image, /order
>
>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>> This first part works fine. The problem is below, when I try to write
>> the result image
>
>> ;;;;;;;;
>> ;;;;;;;;using write_tif
>> ;;;;;;;;
>> ;;_______TIF
>> newRed = reform(newRed)
>> newGreen = reform(newGreen)
>> newBlue = reform(newBlue)
>
>> Write_tiff, 'C:\IDL\tests\mytif.tif', image, $
>> RED=newred,GREEN=newgreen,BLUE=newblue
>> ;;;;;;;;
>> ;;;;;;;;I've also tried using write_Jpeg
>> ;;;;;;;;
>> ;_______JPEG
>> array = bytarr(3,x,y)
>> array[0,*,*] = newred[image]
>> array[1,*,*] = newgreen[image]
>> array[2,*,*] = newblue[image]
>
>> Write_jpeg, 'C:\IDL\tests\myimage.jpg',array, TRUE = 1
>
>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;
>
>> Does anyone have any idea whats wrong? I'm sure its very easy problem
>> to treat, but I'm stuck on this problem for 1 week.
>
>> Thank you
>> Aleksander
>
> So what is "the problem"? What goes wrong?

I forgot to say that I can't visualize my image after I write it to
disk using write_tiff or write_jpeg.
Sorry.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Annoying ROIs
Next Topic: XYZ object scene values from camera perspective

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

Current Time: Fri Oct 10 07:38:40 PDT 2025

Total time taken to generate the page: 1.75705 seconds