function [lclrlt, lchrlt, hclrlt, hchrlt, lclrht, lchrht, hclrht, hchrht] = WaveletDecom3D(X, h0, h1)

[numrows, numcols, numtime] = size(X);

low_col = zeros(numrows, numcols, numtime);
high_col = zeros(numrows, numcols, numtime);

% Filter columns
for t= 1:numtime
	for i=1:numcols
	    low_col(:,i,t) = filter(h0, 1, X(:,i,t));
	    high_col(:,i,t) = filter(h1, 1, X(:,i,t));
	end
end   

% Downsample columns
low_col = low_col(2:2:end,:,:);
high_col = high_col(2:2:end,:,:);

lclr = zeros(numrows/2, numcols, numtime);
lchr = zeros(numrows/2, numcols, numtime);
hclr = zeros(numrows/2, numcols, numtime);
hchr = zeros(numrows/2, numcols, numtime);

% Filter rows
for t=1:numtime
	for j=1:(numrows/2)
    	lclr(j,:,t) = filter(h0, 1, low_col(j,:,t));     
    	lchr(j,:,t) = filter(h1, 1, low_col(j,:,t));
    	hclr(j,:,t) = filter(h0, 1, high_col(j,:,t));     
    	hchr(j,:,t) = filter(h1, 1, high_col(j,:,t));
 	end
end 
% Downsample rows
lclr = lclr(:, 2:2:end, :);
lchr = lchr(:, 2:2:end, :);
hclr = hclr(:, 2:2:end, :);
hchr = hchr(:, 2:2:end, :);

lclrlt = zeros(numrows/2, numcols/2, numtime);
lchrlt = zeros(numrows/2, numcols/2, numtime);
hclrlt = zeros(numrows/2, numcols/2, numtime);
hchrlt = zeros(numrows/2, numcols/2, numtime);
lclrht = zeros(numrows/2, numcols/2, numtime);
lchrht = zeros(numrows/2, numcols/2, numtime);
hclrht = zeros(numrows/2, numcols/2, numtime);
hchrht = zeros(numrows/2, numcols/2, numtime);

for j=1:(numrows/2)
   for i=1:(numcols/2)
      lclrlt(j,i,:) = filter(h0, 1, lclr(j,i,:)); 
      lchrlt(j,i,:) = filter(h0, 1, lchr(j,i,:));
      hclrlt(j,i,:) = filter(h0, 1, hclr(j,i,:));
      hchrlt(j,i,:) = filter(h0, 1, hchr(j,i,:));
      lclrht(j,i,:) = filter(h1, 1, lclr(j,i,:));
      lchrht(j,i,:) = filter(h1, 1, lchr(j,i,:));
      hclrht(j,i,:) = filter(h1, 1, hclr(j,i,:));
      hchrht(j,i,:) = filter(h1, 1, hchr(j,i,:));      
   end   
end

lclrlt = lclrlt(:, :, 2:2:end); 
lchrlt = lchrlt(:, :, 2:2:end);
hclrlt = hclrlt(:, :, 2:2:end); 
hchrlt = hchrlt(:, :, 2:2:end);
lclrht = lclrht(:, :, 2:2:end); 
lchrht = lchrht(:, :, 2:2:end);
hclrht = hclrht(:, :, 2:2:end); 
hchrht = hchrht(:, :, 2:2:end);