Exemplo n.º 1
0
 private double ParseVarianceThreshold(MWStructArray array)
 {
     if (array.IsField(fieldName: "var_thr"))
     {
         var tmpVarThr = (double[, ])array.GetField(fieldName: "var_thr");
         return(tmpVarThr[0, 0]);
     }
     return(double.NaN);
 }
Exemplo n.º 2
0
 private double ParseAmplitudeThreshold(MWStructArray array)
 {
     if (array.IsField(fieldName: "amp_thr"))
     {
         var tmpAmpThr = (double[, ])array.GetField(fieldName: "amp_thr");
         return(tmpAmpThr[0, 0]);
     }
     return(double.NaN);
 }
Exemplo n.º 3
0
 private double ParseIndex(MWStructArray array)
 {
     if (array.IsField(fieldName: "index"))
     {
         var tmpIndex = (double[, ])array.GetField(fieldName: "index");
         return(tmpIndex[0, 0]);
     }
     return(double.NaN);
 }
Exemplo n.º 4
0
 private int[] ParseMerged(MWStructArray array)
 {
     if (array.IsField(fieldName: "merged"))
     {
         var tmpMerged = (double[, ])array.GetField(fieldName: "merged");
         var merged    = new int[tmpMerged.Length];
         for (var i = 0; i < tmpMerged.Length; ++i)
         {
             merged[i] = (int)tmpMerged[0, i];
         }
         return(merged);
     }
     return(null);
 }
Exemplo n.º 5
0
 private bool[] ParseVarianceFilter(MWStructArray array)
 {
     if (array.IsField(fieldName: "var_filter"))
     {
         var tmpVarFilter = (bool[, ])array.GetField(fieldName: "var_filter");
         var varFilter    = new bool[tmpVarFilter.Length];
         for (var i = 0; i < tmpVarFilter.Length; ++i)
         {
             varFilter[i] = tmpVarFilter[i, 0];
         }
         return(varFilter);
     }
     return(null);
 }
Exemplo n.º 6
0
 private bool[] ParseAmplitudeFilter(MWStructArray array)
 {
     if (array.IsField(fieldName: "amp_filter"))
     {
         var tmpAmpFilter = (bool[, ])array.GetField(fieldName: "amp_filter");
         var ampFilter    = new bool[tmpAmpFilter.Length];
         for (var i = 0; i < tmpAmpFilter.Length; ++i)
         {
             ampFilter[i] = tmpAmpFilter[i, 0];
         }
         return(ampFilter);
     }
     return(null);
 }
Exemplo n.º 7
0
 private int[] ParsePartition(MWStructArray array)
 {
     if (array.IsField(fieldName: "partition"))
     {
         var tmpPartition = (double[, ])array.GetField(fieldName: "partition");
         var partition    = new int[tmpPartition.Length];
         for (var i = 0; i < tmpPartition.Length; ++i)
         {
             // -1 for indexing purposes (label should allow to check centroid)
             partition[i] = (int)tmpPartition[0, i] - 1;
         }
         return(partition);
     }
     return(null);
 }
Exemplo n.º 8
0
 private DivikResult[] ParseSubregions(MWStructArray array)
 {
     if (array.IsField(fieldName: "subregions"))
     {
         var tmpSubregions = (MWCellArray)array.GetField(fieldName: "subregions");
         var subregions    = new DivikResult[tmpSubregions.NumberOfElements];
         for (var i = 0; i < tmpSubregions.NumberOfElements; ++i)
         {
             if (tmpSubregions[i + 1] is MWStructArray)
             {
                 subregions[i] = new DivikResult(matlabResult: tmpSubregions[i + 1]);
             }
         }
         return(subregions);
     }
     return(null);
 }
Exemplo n.º 9
0
 private double[,] ParseCentroids(MWStructArray array)
 {
     if (array.IsField(fieldName: "centroids"))
     {
         var transposed = (double[, ])array.GetField(fieldName: "centroids");
         var straight   = new double[transposed.GetLength(dimension: 1), transposed.GetLength(dimension: 0)];
         for (var i = 0; i < transposed.GetLength(dimension: 1); ++i)
         {
             for (var j = 0; j < transposed.GetLength(dimension: 0); ++j)
             {
                 straight[i, j] = transposed[j, i];
             }
         }
         return(straight);
     }
     return(null);
 }