Commit 6443dc91 authored by lafabregue's avatar lafabregue

Update arff import to data to integrate as ImageData - 2

parent 96f706a8
package jcl.data.sampling;
import java.util.List;
import java.util.Vector;
import jcl.data.DataObject;
import jcl.data.mask.Mask;
import jcl.utils.exceptions.MethodNotImplementedException;
import loci.formats.FormatException;
/**
*
* Implementation of the Sample class for extract some sample from an image
* The implementation is the same as ImageSampler but the dataObjects sample
* produce is set at the constructor and just retrieved. Note that the construction
* with a Mask is not yet supported.
*
* @author Baptiste LAFABREGUE
*
*/
public class ImportedImageSampler extends ImageSampler{
/** */
private static final long serialVersionUID = 1L;
private final List<DataObject> importedSample;
/**
* Constructor from a sequence of images
*
* @param imagesPaths
* paths of image's files in the sequence
* @param importedSample
* the set of DataObject that compose the sample
* @param selectedIndexes
* the set of indexes selected in importedSample
*
* @throws FormatException
* if the images don't have the same dimensions
*/
public ImportedImageSampler(final Vector<String> imagesPaths, List<DataObject> importedSample,
List<Integer> selectedIndexes) throws FormatException {
super(imagesPaths);
this.importedSample = importedSample;
this.selectedIndexes = selectedIndexes;
this.setSizeByCount(importedSample.size());
}
/**
* Constructor from a sequence of images with the vectors to know how to match
* pixels between images, we also need to know where to start and end pixels.
* The user should know what are the non overlapping pixels and ignore them.
* It reads only pixel in the rectangle defined by those two points, this is
* different that reading between two indexes.
*
* @param imagesPaths
* paths of image's files in the sequence
* @param geoTranslateVectors
* vector to match images pixels
* @param startX
* X coordinate where to start read images
* @param startY
* Y coordinate where to start read images
* @param endX
* X coordinate where to end read images
* @param endY
* Y coordinate where to end read images
* @param importedSample
* the set of DataObject that compose the sample
* @param selectedIndexes
* the set of indexes selected in importedSample
*
* @throws FormatException
* if the end coordinates are out of the image
*/
public ImportedImageSampler(final Vector<String> imagesPaths, Vector<double[]> geoTranslateVectors,
int startX, int startY, int endX, int endY, List<DataObject> importedSample,
List<Integer> selectedIndexes) throws FormatException {
super(imagesPaths, geoTranslateVectors, startX, startY, endX, endY);
this.importedSample = importedSample;
this.selectedIndexes = selectedIndexes;
this.setSizeByCount(importedSample.size());
}
/**
* Constructor from an image
*
* @param imagesPaths
* the image file path
* @param importedSample
* the set of DataObject that compose the sample
* @param selectedIndexes
* the set of indexes selected in importedSample
*
* @throws FormatException
* if the images don't have the same dimensions
*/
public ImportedImageSampler(final String imagesPaths, List<DataObject> importedSample,
List<Integer> selectedIndexes) {
super(imagesPaths);
this.importedSample = importedSample;
this.selectedIndexes = selectedIndexes;
this.setSizeByCount(importedSample.size());
}
/**
* Copy constructor
*
* @param sampler
* the sampler to copy
* @param importedSample
* the set of DataObject that compose the sample
* @param selectedIndexes
* the set of indexes selected in importedSample
*
* @throws FormatException
* if the images don't have the same dimensions
*/
public ImportedImageSampler(ImageSampler sampler, List<DataObject> importedSample,
List<Integer> selectedIndexes) {
super(sampler);
this.importedSample = importedSample;
this.selectedIndexes = selectedIndexes;
this.setSizeByCount(importedSample.size());
}
@Override
public List<DataObject> getDataObjects() {
return importedSample;
}
@Override
public List<DataObject> getDataObjects(final Mask mask) {
new MethodNotImplementedException("This method is not yet implemented for Mask support").printStackTrace();
return 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