$w][$h] = $bit_plane[$i][$w][$h] &lt;&lt; (7 - $i); 
         }
       }
     }
   }
   return \@bit_plane;                       # Return Bit Plane
 }</code></pre>

<h2 id="A.-red-green-blue-rgb-data">A. ($red,$green,$blue) = rgb($data);</h2>

<p>Returns the RED/GREEN/BLUE layers of a coloured image PDL $data. The separation is done with the PDL::NiceSlice module. So it is an easy task.</p>

<pre><code> sub rgb {
        my ($img) = @_;
        my $red   = $img((0),:,:);      # PDL::NiceSlice
        my $g