def [](index)
      # Dealing with Ranges is useful when the image represents a tensor
      if (index.is_a?(Fixnum) && index >= self.shape[0]) || (index.is_a?(Range) && index.last >= self.shape[0])
        raise IndexError.new("Index over bounds")
      elsif self.shape.count == 1
        if index.is_a?(Range)
          value = []
          index.each { |i| value << self.array_image[get_index_value(i)] }
          value
        else
          self.array_image[get_index_value(index)]
        end
      else
        NImage.new(self.array_image, self.dim, self.previous_indexes.clone << index)
      end
    end
def [](index)
      # Dealing with Ranges is useful when the image represents a tensor
      if (index.is_a?(Fixnum) && index >= self.shape[0]) || (index.is_a?(Range) && index.last >= self.shape[0])
        raise IndexError.new("Index over bounds")
      elsif self.shape.count == 1
        if index.is_a?(Range)
          value = []
          index.each { |i| value << self.array_image[get_index_value(i)] }
          value
        else
          self.array_image[get_index_value(index)]
        end
      else
        NImage.new(self.array_image, self.dim, self.previous_indexes.clone << index)
      end
    end
Creates an NImage instance.

 The NImages instance provides a user friendly interface to the NIFTI Image
 A NImage is typically built by NObject instance

 === Parameters

 * <tt>array_image</tt> -- The NIFTI image contained on and one dimensional array
 * <tt>dim</tt> -- The dimensions array from the NIFTI header.

 === Examples

   # Creates an NImage to deal with an 9 position array that represents a 3x3 matrix
   img = Nimage.new(Array.new(9,0.0), [2,3,3])

 Retrieves an element or partition of the dataset

 === Parameters

 * <tt>index</tt> -- The desired index on the dataset

 === Options

 === Examples

   img[0][0]
   img[0][0..1]