Commit f8c22cfc authored by lafabregue's avatar lafabregue

fixed index computing in ImageSampler

parent c6edaa9a
......@@ -72,7 +72,7 @@ public class AttributeMultiDimSequence extends Attribute {
// contient une sequence de tuples.
public double[][] sequence;
public static final short NB_THREADS = 30;
public static final short NB_THREADS = 50;
public static final boolean[] busy = new boolean[NB_THREADS];
static {
Arrays.fill(busy, false);
......@@ -80,7 +80,7 @@ public class AttributeMultiDimSequence extends Attribute {
/**
* ces attributs et la methode distopt sont déclarés static pour des raisons d'optimisation (on évite des réallocations de mémoire à chaque appel)
*/
private final static int MAX_SEQ_LENGTH = 300;
private final static int MAX_SEQ_LENGTH = 1025;
private static double[][][] matriceW = new double[NB_THREADS][AttributeMultiDimSequence.MAX_SEQ_LENGTH][AttributeMultiDimSequence.MAX_SEQ_LENGTH];
......
......@@ -342,8 +342,9 @@ public class ImageSampler extends Sampler {
} else {
index = getIndex(i);
}
x = ((int) index) % imageWidth;
y = ((int) index) / imageWidth;
// the mask indexes is always related to the first image
x = ((int) index) % readers.get(0).getImageWidth();
y = ((int) index) / readers.get(0).getImageWidth();
result.add(new DataObject(channelCount));
try {
......@@ -508,8 +509,9 @@ public class ImageSampler extends Sampler {
} else {
index = getIndex(i);
}
x = getStartX() + ((int) index) % imageWidth;
y = getStartY() + ((int) index) / imageWidth;
// the mask indexes is always related to the first image
x = getStartX() + ((int) index) % readers.get(0).getImageWidth();
y = getStartY() + ((int) index) / readers.get(0).getImageWidth();
result.add(new DataObject(1));
List<double[]> values = new ArrayList<double[]>();
......@@ -584,8 +586,8 @@ public class ImageSampler extends Sampler {
int channelCount = readers.get(0).getChannelCount();
DataObject result = new DataObject(channelCount);
x = ((int) index) % imageWidth;
y = ((int) index) / imageWidth;
x = ((int) index) % readers.get(0).getImageWidth();
y = ((int) index) / readers.get(0).getImageWidth();
try {
double [] pixel = readers.get(0).getPixel(x, y);
for(int c = 0 ; c < readers.get(0).getChannelCount() ; c++) {
......@@ -613,8 +615,8 @@ public class ImageSampler extends Sampler {
int y = 0;
int channelCount = readers.get(0).getChannelCount();
x = ((int) index) % imageWidth;
y = ((int) index) / imageWidth;
x = ((int) index) % readers.get(0).getImageWidth();
y = ((int) index) / readers.get(0).getImageWidth();
try {
if (geoTranslateVectors != null) {
......
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