#!/usr/bin/perl

# Requires a file called "brain", containing my brain data, in the current directory.
# PDL requires header data in a file called "brain-hdr" as well.

# Requires the PDL module.  
# You can find modules at http://www.perl.com/CPAN/modules/by-module.
# Use the PDL::IO::FastRaw module, a PDL module that can read
# and write raw data from files.
use PDL::IO::FastRaw;

# Read the data from the file "brain" and store it in the pdl $a.
$pdl = readfraw("brain", { Dims => [351,412], ReadOnly => 1 });

# Add 60 to every element.
$pdl += 60;

# Write the pdl back out to the file "brain-brite".
writefraw($pdl, "brain-brite");
