Commit a21a3fbb authored by lafabregue's avatar lafabregue

Fixed the mask application in data construction

parent b4583f2d
......@@ -208,7 +208,6 @@ public class ImageSampler extends Sampler {
@Override
public List<DataObject> getDataObjects(final Mask mask) {
int mandatoryPixelCount = unmaskedPixelsCount(mandatoriesIndexes, mask);
if (mandatoryPixelCount > sizeByCount) {
throw new IndexOutOfBoundsException("The number of mandatory pixels"
......@@ -302,8 +301,8 @@ public class ImageSampler extends Sampler {
int x = 0;
int y = 0;
int channelCount = readers.get(0).getChannelCount();
double tmpOffset = mask.getCarinality() / dataSize;
int iterPos = 0;
double tmpOffset = (double) mask.getCarinality() / sizeByCount;
double iterPos = 0.0;
int index = 0;
Iterator<Integer> iter = null;
switch (getSamplingMethod()) {
......@@ -453,8 +452,8 @@ public class ImageSampler extends Sampler {
int x = 0;
int y = 0;
int channelCount = readers.get(0).getChannelCount();
double tmpOffset = mask.getCarinality() / dataSize;
int iterPos = 0;
double tmpOffset = mask.getCarinality() / sizeByCount;
double iterPos = 0.0;
int index = 0;
Iterator<Integer> iter = null;
switch (getSamplingMethod()) {
......
......@@ -479,7 +479,7 @@ public class LearningResultKmeans extends LearningResult {
if (samples == null || samples.contains(new Integer(-1))) {
for (int i = 0; i < data.getNbObjects(); i++) {
if (Math.random() < ((double) nbClustersLeft / (double) remaining)) {
seeds[index] = data.getDataObject((Integer) samples.get(i));
seeds[index] = data.getDataObject(i);
index++;
nbClustersLeft--;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment