Code covered by the BSD License  

Highlights from
ReadPIC

Be the first to rate this file! 0 Downloads (last 30 days) File Size: 5.49 KB File ID: #19423

ReadPIC

by Phil Larimer

 

02 Apr 2008 (Updated 02 Apr 2008)

Read and write Biorad PIC image files

| Watch this File

File Information
Description

Allows you to read, write, and get information about Biorad PIC image files. The function can be used by themselves or incorporated into the image formats accessible with imread, imwrite, and imfinfo using:
imformats([imformats struct('ext', {'pic'}, 'isa', @ispic, 'info', @impicinfo, 'read',@readbmp, 'write', @writebmp, 'alpha', 0, 'description', 'Biorad Image File (PIC)')]);

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
02 Jun 2010 Gregory Jefferis

Useful submission - many thanks. However there is a bug in writepic that is causing all image data to be shifted by 1 or 2 pixels. Specifically the header should be 76 bytes long but it is currently being written with 74 bytes. That means that the first 2 bytes of image data are lost. Then the writer adds 2 0 bytes at the end of the image. I'll submit a patch as another comment.

02 Jun 2010 Gregory Jefferis

From 6271626b74e8dbca7ae4d6ea08b7358d76323f72 Mon Sep 17 00:00:00 2001
From: Gregory Jefferis <jefferis@gmail.com>
Date: Tue, 1 Jun 2010 03:52:20 +0100
Subject: [PATCH 1/2] Fix bug in writepic resulting in image data off by 2 bytes

* was resulting in 74 rather than 76 byte header
* then appending a spurious 2 bytes after image data
* net effect is that all pixels were displaced by 1 or 2 pixels
---
 ReadPIC/writepic.m | 4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/ReadPIC/writepic.m b/ReadPIC/writepic.m
index 400f528..2f3281d 100644
--- a/ReadPIC/writepic.m
+++ b/ReadPIC/writepic.m
@@ -44,14 +44,12 @@ fid = fopen(filename, 'w');
  fwrite(fid, [tempFileName(1:min([end 32])); zeros(32 - length(tempFileName), 1)], 'char');
  fwrite(fid, [0 7 12345 0 255 7 0], 'int16');
  fwrite(fid, metadata.LensMagnification, 'int16');
- fwrite(fid, metadata.LensFactor, 'int16');
+ fwrite(fid, metadata.LensFactor, 'float');
  fwrite(fid, [0 0 0], 'int16');
 
  % write image data
  fwrite(fid, X, ['uint' sprintf('%0.0f', metadata.BitDepth)]);
 
- fwrite(fid, 0, 'int16');
-
  writeComment(fid, ['PIXEL_BIT_DEPTH = ' metadata.BitDepth])
  writeComment(fid, 'PIC_FF_VERSION = 4.5')
 
--
1.6.3.3.334.g916e1

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
graphics import Phil Larimer 22 Oct 2008 09:56:12
graphics export Phil Larimer 22 Oct 2008 09:56:12
zeiss Cristina McIntire 05 Feb 2009 15:06:38
biorad Cristina McIntire 05 Feb 2009 15:06:38
confocal Cristina McIntire 05 Feb 2009 15:06:38
twophoton Cristina McIntire 05 Feb 2009 15:06:38
image file Cristina McIntire 05 Feb 2009 15:06:38

Contact us at files@mathworks.com