visualdatatools.com Forum Index visualdatatools.com
Discussion for DataTank and DataGraph
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

support for 32 bit images

 
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Feature Request
View previous topic :: View next topic  
Author Message
Adam



Joined: 01 Dec 2006
Posts: 61
Location: Sequim, WA

PostPosted: Mon Dec 04, 2006 8:53 pm    Post subject: support for 32 bit images Reply with quote

I interact with some imagery people who have to use weirdly inflexible software, and sometimes produce >16 bit images. Preview can read some of them, surprisingly, so I just saved one from Preview as 8 bit TIFF. DT can't read that one, either, so we're trying to figure out another workaround.
Back to top
View user's profile Send private message
David
Site Admin


Joined: 25 Nov 2006
Posts: 1964
Location: Chapel Hill, NC

PostPosted: Mon Dec 04, 2006 9:51 pm    Post subject: Reply with quote

Can you send me a sample image? I can read 16 bit images, and it is easy to implement a 32bit per channel "2D Bitmap" object. I would then also add this to DTBitmap2D so you can hand them to external programs. Are these floats or 32 bit integers?

David
Back to top
View user's profile Send private message Send e-mail
Adam



Joined: 01 Dec 2006
Posts: 61
Location: Sequim, WA

PostPosted: Mon Dec 04, 2006 10:29 pm    Post subject: Reply with quote

David wrote:
Can you send me a sample image? I can read 16 bit images, and it is easy to implement a 32bit per channel "2D Bitmap" object. I would then also add this to DTBitmap2D so you can hand them to external programs. Are these floats or 32 bit integers?

David


The file is supposed to have floats; I'll post something to our file transfer service and send you the link. We finally used an ESRI ASCII grid file, which works fine.
Back to top
View user's profile Send private message
Adam



Joined: 01 Dec 2006
Posts: 61
Location: Sequim, WA

PostPosted: Mon Jan 15, 2007 1:53 pm    Post subject: Reply with quote

I thought I'd take a look at this myself. I can read in the 32 bit float tiff using ImageIO, create a CGImageRef in a CIContext, and write that back out to disk with no apparent loss. Hence, I'm convinced that I'm reading the image OK.

My problem now is in converting that image to either a 2D Mesh (as grayscale), or a 2D Bitmap. I tried creating an NSBitmapImageRep and using -[NSBitmapImageRep getPixel:atX:y], but I seem to end up with an 8 bit image.

I'm not used to working with raw pixel data, but presumably I need to get the actual buffer that I passed to CGBitmapContextCreate and then stuff those pixel values into a DTMutableFloatArray (for the grayscale route). Does that sound right? Or am I making this way too hard?
Back to top
View user's profile Send private message
Adam



Joined: 01 Dec 2006
Posts: 61
Location: Sequim, WA

PostPosted: Tue May 29, 2007 3:55 pm    Post subject: Reply with quote

I finally had to get this working for a couple of projects, and it turned out to be pretty easy for 32 bit grayscale images; extending it to multichannel images should be easy enough.

I'm passing a GeoTIFF as filename to an external program, creating an NSBitmapImageRep from it, and returning a DTMesh2D. By linking with libtiff/libgeotiff, I'm also able to read the origin and pixel size directly, so the returned mesh is properly georeferenced. If anyone's interested, I can post code snippets. -[NSBitmapImageRep getPixel:atX:y:] was /not/ a good way to do this.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Feature Request All times are GMT - 3 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group