Commit f8c22cfc authored by lafabregue's avatar lafabregue

fixed index computing in ImageSampler

parent c6edaa9a
...@@ -72,7 +72,7 @@ public class AttributeMultiDimSequence extends Attribute { ...@@ -72,7 +72,7 @@ public class AttributeMultiDimSequence extends Attribute {
// contient une sequence de tuples. // contient une sequence de tuples.
public double[][] sequence; 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]; public static final boolean[] busy = new boolean[NB_THREADS];
static { static {
Arrays.fill(busy, false); Arrays.fill(busy, false);
...@@ -80,7 +80,7 @@ public class AttributeMultiDimSequence extends Attribute { ...@@ -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) * 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]; 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 { ...@@ -342,8 +342,9 @@ public class ImageSampler extends Sampler {
} else { } else {
index = getIndex(i); index = getIndex(i);
} }
x = ((int) index) % imageWidth; // the mask indexes is always related to the first image
y = ((int) index) / imageWidth; x = ((int) index) % readers.get(0).getImageWidth();
y = ((int) index) / readers.get(0).getImageWidth();
result.add(new DataObject(channelCount)); result.add(new DataObject(channelCount));
try { try {
...@@ -508,8 +509,9 @@ public class ImageSampler extends Sampler { ...@@ -508,8 +509,9 @@ public class ImageSampler extends Sampler {
} else { } else {
index = getIndex(i); index = getIndex(i);
} }
x = getStartX() + ((int) index) % imageWidth; // the mask indexes is always related to the first image
y = getStartY() + ((int) index) / imageWidth; x = getStartX() + ((int) index) % readers.get(0).getImageWidth();
y = getStartY() + ((int) index) / readers.get(0).getImageWidth();
result.add(new DataObject(1)); result.add(new DataObject(1));
List<double[]> values = new ArrayList<double[]>(); List<double[]> values = new ArrayList<double[]>();
...@@ -584,8 +586,8 @@ public class ImageSampler extends Sampler { ...@@ -584,8 +586,8 @@ public class ImageSampler extends Sampler {
int channelCount = readers.get(0).getChannelCount(); int channelCount = readers.get(0).getChannelCount();
DataObject result = new DataObject(channelCount); DataObject result = new DataObject(channelCount);
x = ((int) index) % imageWidth; x = ((int) index) % readers.get(0).getImageWidth();
y = ((int) index) / imageWidth; y = ((int) index) / readers.get(0).getImageWidth();
try { try {
double [] pixel = readers.get(0).getPixel(x, y); double [] pixel = readers.get(0).getPixel(x, y);
for(int c = 0 ; c < readers.get(0).getChannelCount() ; c++) { for(int c = 0 ; c < readers.get(0).getChannelCount() ; c++) {
...@@ -613,8 +615,8 @@ public class ImageSampler extends Sampler { ...@@ -613,8 +615,8 @@ public class ImageSampler extends Sampler {
int y = 0; int y = 0;
int channelCount = readers.get(0).getChannelCount(); int channelCount = readers.get(0).getChannelCount();
x = ((int) index) % imageWidth; x = ((int) index) % readers.get(0).getImageWidth();
y = ((int) index) / imageWidth; y = ((int) index) / readers.get(0).getImageWidth();
try { try {
if (geoTranslateVectors != null) { 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