Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'ReadList problem' topicStudent Support Forum > General > Archives > "ReadList problem"

Help | Reply To Topic
Author Comment/Response
Dan Symes
06/27/01 08:33am

Hi, I hope someone can help me with this problem.

I have set of CCD images (512x512 pixels) taken with an image grabber and saved as .raw or .im files. When I open up the images in Paint Shop Pro, they all look OK.

I am trying to read the data into Mathematica (version 4) as a list using:

a = ReadList["file", Byte, 512*512];

and then convert the numbers into a table of 256x512. (Because of the way the image grabber works a duplicate image has to be ignored) using:

cc = Table[a[[512*i + j]], {i, 0, 511, 2}, {j, 1, 512}];

This works fine with some of the images but for others it comes up with an error when I try to execute the "cc=Table..." command. eg:

Part::partw: Part 79 of <<l>> does not exist
Part::partw: Part 80 of <<l>> does not exist
Part::partw: Part 81 of <<l>> does not exist
General::stop:"Further output of Part::partw will be suppressed during this calculation."

When I ListPlot [a] to see what Mathematica has read in, I see on the images that work it has read in ~250000 numbers but on the images which don't it has stopped reading at some point.

I think maybe it is a corrupt pixel on the original image which somehow Mathematica is unable to read. If so I might be able to solve the problem by reading in the list but skipping the pixel which Mathematica cannot read but I don't know whether this is possible.

Does anyone have any ideas? Any help would be greatly appreciated.


Help | Reply To Topic