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

Home » Public Forums » archive » Re: 3D images
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: 3D images [message #39826] Tue, 22 June 2004 04:54
Timm Weitkamp is currently offline  Timm Weitkamp
Messages: 66
Registered: August 2002
Member
On 21.06.04 at 12:00 -0700, Jeff wrote:

> This is really cool, but now i'm wondering how you figure out things
> like this :) Is there a book or some other resource (webpage?) that I
> can tap into that deals with creating shapes in images mathmatically?
> I can figure some basic stuff out myself (I can do a square! woohoo!)
> but I'd like to learn more. Is this called morphometry?

Jeff:

Do you mean, how do I do manage to do things in a complicated way that
take only little more than a one-liner when done properly, as David has
just pointed out? :-(

But seriously: I guess the only "resource" is the *need* to solve a given
problem, and some very basic geometry knowledge. Like in this case: x^2 +
y^2 < r^2 defines a filled circle. No need to be a math pro for that,
thank goodness. I'm sorry, but I really can't point you to any book or web
page [1].

Cheers,
Timm

[1] Except, of course, JD Smith's dimension-juggling tutorial for IDL,
which helps you to get arrays into shape. But you know where to find that,
I hope.

--
Timm Weitkamp <http://people.web.psi.ch/weitkamp>
Re: 3D images [message #39832 is a reply to message #39826] Mon, 21 June 2004 12:01 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jeff writes:

> This is really cool, but now i'm wondering how you figure out things
> like this :) Is there a book or some other resource (webpage?) that I
> can tap into that deals with creating shapes in images mathmatically?
> I can figure some basic stuff out myself (I can do a square! woohoo!)
> but I'd like to learn more. Is this called morphometry?

Last time I looked it was called "geometry". But
I'm probably quite a bit older than you. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: 3D images [message #39833 is a reply to message #39832] Mon, 21 June 2004 12:00 Go to previous message
jnettle1 is currently offline  jnettle1
Messages: 27
Registered: January 2001
Junior Member
Timm,

This is really cool, but now i'm wondering how you figure out things
like this :) Is there a book or some other resource (webpage?) that I
can tap into that deals with creating shapes in images mathmatically?
I can figure some basic stuff out myself (I can do a square! woohoo!)
but I'd like to learn more. Is this called morphometry?

Jeff


Timm Weitkamp <dont.try@this.address> wrote in message news:<Pine.LNX.4.44.0406211459060.1292-100000@localhost.localdomain>...
> On 18.06.04 at 13:49 -0700, Aleks wrote:
>
>> Hello,
>> this board has been very helpful and I was wondering if anyone could
>> help me with the following.
>> I'm trying to construct a cylinder. I made a circle in photoshop and
>> made 10 copies of the file just renaming it. (example circle_01.tiff,
>> ...._02.tiff etc)
>>
>> [...]
>
> If those images do not contain anything more than a binary image of a
> cylinder, then the best is to forget Photoshop and do everything in IDL.
> Like this, for example:
>
>
> ;; (code starts here)
>
> nx = 1600
> ny = 1200
> nz = 80
> radius = 500.0
>
>
> ;; Define coordinates
>
> xVec = FINDGEN(nx) - (nx -1 ) / 2.0
> yVec = FINDGEN(ny) - (ny -1 ) / 2.0
> x = xVec # (1.0 + FLTARR(ny))
> y = yVec ## (1.0 + FLTARR(nx))
> r = SQRT(x^2 + y^2)
>
>
> ;; Calculate image of filled circle
>
> circle = r LT radius
>
>
> ;; Extend circle into third dimension
>
> cylinder = REBIN(circle, nx, ny, nz)
>
>
> ;; "Cap" cylinder with zero slice on top and bottom
>
> cylinder[*, *, 0] = 0
> cylinder[*, *, nz-1] = 0
>
>
> ;; Fire up Slicer3 to visualize interactively
>
> SLICER3, PTR_NEW(cylinder)
>
>
> ;; (code ends here)
>
> In "Slicer3" you can then simply have a 3D isosurface plot drawn by
> selecting "Mode: Surface", then "Low", and clicking on "Display". After
> that, there are lots of ways to change angles, color, etc.
>
> There are alternatives to SLICER3, among which are XVOLUME and Volume
> Objects. Just try and see which suits you best.
>
> Hope this helps
>
> Timm
Re: 3D images [message #39837 is a reply to message #39833] Mon, 21 June 2004 09:46 Go to previous message
siliconcube is currently offline  siliconcube
Messages: 11
Registered: June 2004
Junior Member
Hi Jeff,
thank you very much that solved my problem.
Aleks
jnettle1@utk.edu (Jeff) wrote in message news:<330af58b.0406192254.62eefa2f@posting.google.com>...
> Al,
>
> The problem seems to be the way you're making the tif files in
> Photoshop. Photoshop has lots of optional items you can put in tif
> files (including, i think, preserving Photoshop layers now). I'm not
> surprised at all that IDL is having problems reading them. I'd go
> back to Photoshop and try to make the simplest file you can
> make....flatten the image before you save it, make sure it's not
> compressed, etc. Also, note that your code is going to bomb unless
> you have Photoshop save grayscale files instead of RGB mode files.
> The read_tiff routine will assign a [3,m,n] array to the variable
> image that you then try to assign to a single band in the variable
> volume. (I'm sure you know this but you also have to be saving 8-bit
> tif files in Photoshop or otherwise not use byte arrays in IDL) You
> may also want to use the count keyword to findfile and use that in
> setting up the volume (ie, volume = bytarr(1600,1200,count)) and in
> the loop that reads the tiffs (for j = 0, count-1 etc). Anyway, i did
> what you said you did....made a tif file in photoshop, made copies,
> and then ran your code (modified as i suggested above) and it worked
> fine, though i didn't bother sorting the images since they were all
> the same in my rough little experiment. Good luck.
>
> Jeff
>
> siliconcube@yahoo.com (Aleks) wrote in message news:<79140897.0406181249.6e0342b5@posting.google.com>...
>> Hello,
>> this board has been very helpful and I was wondering if anyone could
>> help me with the following.
>> I'm trying to construct a cylinder. I made a circle in photoshop and
>> made 10 copies of the file just renaming it. (example circle_01.tiff,
>> ...._02.tiff etc)
>>
>> this is the code I have (which is barely modified code from Dr.
>> Fannings website) and with the following code i was hoping to get an
>> isosurface of a cylinder and this is the error that I get before I
>> make past the last line:
>> % READ_TIFF: Not a TIFF file, bad magic number 19778 (0x4d42)
>> % Execution halted at: $MAIN$
>> The images are TIFF Files, I checked them from properties tab in
>> windows.
>> when I run query_tiff command I get the following error
>> IDL> ok = query_tiff('test_01.tif', info)
>> % Loaded DLM: TIFF.
>> IDL> print, info.dimensions
>> % Expression must be a structure in this context: INFO.
>> % Execution halted at: $MAIN$
>>
>>
>> files=findfile('*.tif')
>> index=bsort(files, sortedfiles)
>> volume=bytarr(1600,1200,80)
>> for j=0,9 do begin
>> image=read_tiff(sortedfiles[j])
>> volume[*,*,j] = image
>> endfor
>>
>> Thank you
>> Al
Re: 3D images [message #39843 is a reply to message #39837] Mon, 21 June 2004 06:39 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Timm Weitkamp writes:

> If those images do not contain anything more than a binary image of a
> cylinder, then the best is to forget Photoshop and do everything in IDL.
> Like this, for example:

Or, a little more succinctly, you could do it in one
call to MESH_OBJ. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: 3D images [message #39844 is a reply to message #39843] Mon, 21 June 2004 06:31 Go to previous message
Timm Weitkamp is currently offline  Timm Weitkamp
Messages: 66
Registered: August 2002
Member
On 18.06.04 at 13:49 -0700, Aleks wrote:

> Hello,
> this board has been very helpful and I was wondering if anyone could
> help me with the following.
> I'm trying to construct a cylinder. I made a circle in photoshop and
> made 10 copies of the file just renaming it. (example circle_01.tiff,
> ...._02.tiff etc)
>
> [...]

If those images do not contain anything more than a binary image of a
cylinder, then the best is to forget Photoshop and do everything in IDL.
Like this, for example:


;; (code starts here)

nx = 1600
ny = 1200
nz = 80
radius = 500.0


;; Define coordinates

xVec = FINDGEN(nx) - (nx -1 ) / 2.0
yVec = FINDGEN(ny) - (ny -1 ) / 2.0
x = xVec # (1.0 + FLTARR(ny))
y = yVec ## (1.0 + FLTARR(nx))
r = SQRT(x^2 + y^2)


;; Calculate image of filled circle

circle = r LT radius


;; Extend circle into third dimension

cylinder = REBIN(circle, nx, ny, nz)


;; "Cap" cylinder with zero slice on top and bottom

cylinder[*, *, 0] = 0
cylinder[*, *, nz-1] = 0


;; Fire up Slicer3 to visualize interactively

SLICER3, PTR_NEW(cylinder)


;; (code ends here)

In "Slicer3" you can then simply have a 3D isosurface plot drawn by
selecting "Mode: Surface", then "Low", and clicking on "Display". After
that, there are lots of ways to change angles, color, etc.

There are alternatives to SLICER3, among which are XVOLUME and Volume
Objects. Just try and see which suits you best.

Hope this helps

Timm

--
Timm Weitkamp <http://people.web.psi.ch/weitkamp>
Re: 3D images [message #39848 is a reply to message #39844] Sat, 19 June 2004 23:54 Go to previous message
jnettle1 is currently offline  jnettle1
Messages: 27
Registered: January 2001
Junior Member
Al,

The problem seems to be the way you're making the tif files in
Photoshop. Photoshop has lots of optional items you can put in tif
files (including, i think, preserving Photoshop layers now). I'm not
surprised at all that IDL is having problems reading them. I'd go
back to Photoshop and try to make the simplest file you can
make....flatten the image before you save it, make sure it's not
compressed, etc. Also, note that your code is going to bomb unless
you have Photoshop save grayscale files instead of RGB mode files.
The read_tiff routine will assign a [3,m,n] array to the variable
image that you then try to assign to a single band in the variable
volume. (I'm sure you know this but you also have to be saving 8-bit
tif files in Photoshop or otherwise not use byte arrays in IDL) You
may also want to use the count keyword to findfile and use that in
setting up the volume (ie, volume = bytarr(1600,1200,count)) and in
the loop that reads the tiffs (for j = 0, count-1 etc). Anyway, i did
what you said you did....made a tif file in photoshop, made copies,
and then ran your code (modified as i suggested above) and it worked
fine, though i didn't bother sorting the images since they were all
the same in my rough little experiment. Good luck.

Jeff

siliconcube@yahoo.com (Aleks) wrote in message news:<79140897.0406181249.6e0342b5@posting.google.com>...
> Hello,
> this board has been very helpful and I was wondering if anyone could
> help me with the following.
> I'm trying to construct a cylinder. I made a circle in photoshop and
> made 10 copies of the file just renaming it. (example circle_01.tiff,
> ...._02.tiff etc)
>
> this is the code I have (which is barely modified code from Dr.
> Fannings website) and with the following code i was hoping to get an
> isosurface of a cylinder and this is the error that I get before I
> make past the last line:
> % READ_TIFF: Not a TIFF file, bad magic number 19778 (0x4d42)
> % Execution halted at: $MAIN$
> The images are TIFF Files, I checked them from properties tab in
> windows.
> when I run query_tiff command I get the following error
> IDL> ok = query_tiff('test_01.tif', info)
> % Loaded DLM: TIFF.
> IDL> print, info.dimensions
> % Expression must be a structure in this context: INFO.
> % Execution halted at: $MAIN$
>
>
> files=findfile('*.tif')
> index=bsort(files, sortedfiles)
> volume=bytarr(1600,1200,80)
> for j=0,9 do begin
> image=read_tiff(sortedfiles[j])
> volume[*,*,j] = image
> endfor
>
> Thank you
> Al
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Saving an application state
Next Topic: TeXtoIDL update: Easy Greek letters in IDL

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

Current Time: Wed Oct 08 18:39:53 PDT 2025

Total time taken to generate the page: 0.00687 seconds