def set_parameters
      # Convert the volumes to vectors:
      @vectors = Array.new
      @volumes.each {|volume| @vectors << volume.flatten}
      verify_equal_vector_lengths
      # Number of voxels:
      @n = @vectors.first.length
      # Number of raters:
      @r = @vectors.length
      # Decisions array:
      @decisions = NArray.int(@n, @r)
      # Sensitivity vector: (Def: true positive fraction, or relative frequency of Dij = 1 when Ti = 1)
      # (If a rater includes all the voxels that are included in the true segmentation, his score is 1.0 on this parameter)
      @p = NArray.float(@r)
      # Specificity vector: (Def: true negative fraction, or relative frequency of Dij = 0 when Ti = 0)
      # (If a rater has avoided to specify any voxels that are not specified in the true segmentation, his score is 1.0 on this parameter)
      @q = NArray.float(@r)
      # Set initial parameter values: (p0, q0) - when combined, called: phi0
      @p.fill!(0.99999)
      @q.fill!(0.99999)
      # Combined scoring parameter:
      @phi = NArray.float(2, @r)
      # Fill the decisions matrix:
      @vectors.each_with_index do |decision, j|
        @decisions[true, j] = decision
      end
      # Indicator vector of the true (hidden) segmentation:
      @true_segmentation = NArray.byte(@n)
      # The estimate of the probability that the true segmentation at each voxel is Ti = 1: f(Ti=1)
      @weights_previous = NArray.float(@n)
      # Using the notation commom for EM algorithms and refering to this as the weight variable:
      @weights_current = NArray.float(@n)
    end
def set_parameters
      # Convert the volumes to vectors:
      @vectors = Array.new
      @volumes.each {|volume| @vectors << volume.flatten}
      verify_equal_vector_lengths
      # Number of voxels:
      @n = @vectors.first.length
      # Number of raters:
      @r = @vectors.length
      # Decisions array:
      @decisions = NArray.int(@n, @r)
      # Sensitivity vector: (Def: true positive fraction, or relative frequency of Dij = 1 when Ti = 1)
      # (If a rater includes all the voxels that are included in the true segmentation, his score is 1.0 on this parameter)
      @p = NArray.float(@r)
      # Specificity vector: (Def: true negative fraction, or relative frequency of Dij = 0 when Ti = 0)
      # (If a rater has avoided to specify any voxels that are not specified in the true segmentation, his score is 1.0 on this parameter)
      @q = NArray.float(@r)
      # Set initial parameter values: (p0, q0) - when combined, called: phi0
      @p.fill!(0.99999)
      @q.fill!(0.99999)
      # Combined scoring parameter:
      @phi = NArray.float(2, @r)
      # Fill the decisions matrix:
      @vectors.each_with_index do |decision, j|
        @decisions[true, j] = decision
      end
      # Indicator vector of the true (hidden) segmentation:
      @true_segmentation = NArray.byte(@n)
      # The estimate of the probability that the true segmentation at each voxel is Ti = 1: f(Ti=1)
      @weights_previous = NArray.float(@n)
      # Using the notation commom for EM algorithms and refering to this as the weight variable:
      @weights_current = NArray.float(@n)
    end
Sets the instance attributes used by the STAPLE algorithm.