def remove_empty_indices
      # (Note that this implementation aims to be independent of the number of
      # dimensions in the input segmentation.)
      # It only makes sense to run this volume reduction if the number of dimensions are 2 or more:
      if @original_volumes.first.dim > 1
        # To be able to reconstruct the volume later on, we need to keep track of the original indices
        # of the indices that remain in the new, reduced volume:
        @original_indices = Array.new(@original_volumes.first.dim)
        # For a volume the typical meaning of the dimensions will be: slice, column, row
        @original_volumes.first.shape.each_with_index do |size, dim_index|
          extract = Array.new(@original_volumes.first.dim, true)
          segmented_indices = Array.new
          size.times do |i|
            extract[dim_index] = i
            segmented = false
            @volumes.each do |volume|
              segmented = true if volume[*extract].max > 0
            end
            segmented_indices << i if segmented
          end
          @original_indices[dim_index] = segmented_indices
          extract[dim_index] = segmented_indices
          # Iterate each volume and pull out segmented indices:
          if segmented_indices.length < size
            @volumes.collect!{|volume| volume = volume[*extract]}
          end
        end
      end
    end
def remove_empty_indices
      # (Note that this implementation aims to be independent of the number of
      # dimensions in the input segmentation.)
      # It only makes sense to run this volume reduction if the number of dimensions are 2 or more:
      if @original_volumes.first.dim > 1
        # To be able to reconstruct the volume later on, we need to keep track of the original indices
        # of the indices that remain in the new, reduced volume:
        @original_indices = Array.new(@original_volumes.first.dim)
        # For a volume the typical meaning of the dimensions will be: slice, column, row
        @original_volumes.first.shape.each_with_index do |size, dim_index|
          extract = Array.new(@original_volumes.first.dim, true)
          segmented_indices = Array.new
          size.times do |i|
            extract[dim_index] = i
            segmented = false
            @volumes.each do |volume|
              segmented = true if volume[*extract].max > 0
            end
            segmented_indices << i if segmented
          end
          @original_indices[dim_index] = segmented_indices
          extract[dim_index] = segmented_indices
          # Iterate each volume and pull out segmented indices:
          if segmented_indices.length < size
            @volumes.collect!{|volume| volume = volume[*extract]}
          end
        end
      end
    end
Computes a hash code for this object.

 @note Two objects with the same attributes will have the same hash code.

 @return [Fixnum] the object's hash code

 Along each dimension of the input volumes, removes any index (slice,
 column or row) which is empty in all volumes. The result is a reduced
 volume used for the analysis, yielding scores with better contrast on
 specificity.