function [ ] = pcaimages( numberofimages,cropper)
%Reads, rangescales and registers n images, crops and rescales all 
%identically, and applies PCA.
%   
%To ensure functionality, ensure your current folder contains your images.
%OUTPUT: [.bil multispectral image,data,pc,score]
%INPUT: (number of images to use,topleft x,topleft y,btm right x,btm right y,scale)
global nrows
fc=cropper(1);
fr=cropper(2);
lc=cropper(3);
lr=cropper(4);
bil=imget(numberofimages);
bil=registerbil(bil);
bil=cropbil(bil,fr,lr,fc,lc,1);
[bil]=pixelrange2(bil);
[d,p,s,l,e]=makepcabil(bil);
for w=1:numberofimages;
scoreimages(:,:,w)=imadjust(mat2gray(reshape(s(:,w),nrows,[])),stretchlim(mat2gray(reshape(s(:,w),nrows,[]))),[]);
end
explain=e;
latent=l;
data=reshape(bil,[],numberofimages);
putvar(scoreimages,bil,d,p,s,nrows,latent,explain,data)
end