Package digilib.io
Class ImageSet
- java.lang.Object
-
- digilib.io.ImageSet
-
- Direct Known Subclasses:
DocuImageSet
,ImageFileSet
public class ImageSet extends Object
Set of ImageInputs of the same image in different resolutions. The images are be added in the order of higher to lower resolutions. The first image is considered the hires "original".- Author:
- casties
-
-
Constructor Summary
Constructors Constructor Description ImageSet()
Creator for empty fileset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(ImageInput f)
Adds an ImageInput to this ImageSet.void
append(ImageSet imgs)
Append all ImageInputs from another ImageSet (at the end).void
checkMeta()
ImageInput
get()
Gets the default Input.ImageInput
get(int index)
Get the ImageInput at the index.float
getAspect()
Returns the aspect ratio.ImageInput
getBiggest()
Returns the biggest ImageInput in the set.ImageInput
getBiggestPreferred(ImageInput.InputTag tag)
Returns the biggest ImageInput in the set.ListIterator<ImageInput>
getHiresIterator()
Get an Iterator for this Fileset starting at the highest resolution image.ListIterator<ImageInput>
getLoresIterator()
Get an Iterator for this Fileset starting at the lowest resolution images.ImageInput
getNextBigger(ImageSize size)
Get the next bigger ImageInput than the given size.ImageInput
getNextBigger(ImageSize size, ImageInput.InputTag tag)
Get the next bigger ImageInput with the given tag than the given size.ImageInput
getNextBiggerPreferred(ImageSize size, ImageInput.InputTag tag)
Get the next bigger ImageInput than the given size preferring (same-size) images with the given tag.ImageInput
getNextSmaller(ImageSize size)
Get the next smaller ImageInput than the given size.ImageInput
getNextSmaller(ImageSize size, ImageInput.InputTag tag)
Get the next smaller ImageInput with the given tag than the given size.ImageInput
getNextSmallerPreferred(ImageSize size, ImageInput.InputTag tag)
Get the next smaller ImageInput than the given size preferring (same-size) images with the given tag.float
getResX()
float
getResY()
ImageInput
getSmallest()
Returns the smallest ImageInput in the set.ImageInput
getSmallestPreferred(ImageInput.InputTag tag)
Returns the smallest ImageInput in the set.void
setAspect(ImageSize s)
Sets the aspect ratio from an ImageSize.int
size()
The number of image files in this Fileset.
-
-
-
Field Detail
-
list
protected List<ImageInput> list
list of files (ImageInput)
-
aspect
protected float aspect
aspect ratio (width/height)
-
resX
protected float resX
resolution of the biggest image (DPI)
-
resY
protected float resY
resolution of the biggest image (DPI)
-
-
Method Detail
-
size
public int size()
The number of image files in this Fileset.- Returns:
- number of image files
-
get
public ImageInput get()
Gets the default Input.- Returns:
- the ImageInput
-
get
public ImageInput get(int index)
Get the ImageInput at the index.- Parameters:
index
- the index- Returns:
- the ImageInput
-
getNextSmaller
public ImageInput getNextSmaller(ImageSize size)
Get the next smaller ImageInput than the given size. Returns the ImageInput from the set that has a width and height smaller or equal the given size. Returns null if there isn't any smaller image.- Parameters:
size
- the size- Returns:
- the ImageInput
-
getNextSmaller
public ImageInput getNextSmaller(ImageSize size, ImageInput.InputTag tag)
Get the next smaller ImageInput with the given tag than the given size. Returns the ImageInput from the set that has a width and height smaller or equal the given size and has the given tag. Returns null if there isn't any smaller image with the given tag.- Parameters:
size
- the sizetag
- the tag- Returns:
- the ImageInput
-
getNextSmallerPreferred
public ImageInput getNextSmallerPreferred(ImageSize size, ImageInput.InputTag tag)
Get the next smaller ImageInput than the given size preferring (same-size) images with the given tag. Returns the ImageInput from the set that has a width and height smaller or equal the given size. Prefers images with the given tag available at the same size. Returns null if there isn't any smaller image.- Parameters:
size
- the sizetag
- the tag- Returns:
- the ImageInput
-
getNextBigger
public ImageInput getNextBigger(ImageSize size)
Get the next bigger ImageInput than the given size. Returns the ImageInput from the set that has a width or height bigger or equal the given size. Returns null if there isn't any bigger image.- Parameters:
size
- the size- Returns:
- the ImageInput
-
getNextBigger
public ImageInput getNextBigger(ImageSize size, ImageInput.InputTag tag)
Get the next bigger ImageInput with the given tag than the given size. Returns the ImageInput from the set that has a width or height bigger or equal the given size and has the given tag. Returns null if there isn't any bigger image with the given tag.- Parameters:
size
- the sizetag
- the tag- Returns:
- the ImageInput
-
getNextBiggerPreferred
public ImageInput getNextBiggerPreferred(ImageSize size, ImageInput.InputTag tag)
Get the next bigger ImageInput than the given size preferring (same-size) images with the given tag. Returns the ImageInput from the set that has a width and height bigger or equal the given size. Prefers images with the given tag available at the same size. Returns null if there isn't any bigger image.- Parameters:
size
- the sizetag
- the tag- Returns:
- the ImageInput
-
getBiggest
public ImageInput getBiggest()
Returns the biggest ImageInput in the set.- Returns:
- the ImageInput
-
getBiggestPreferred
public ImageInput getBiggestPreferred(ImageInput.InputTag tag)
Returns the biggest ImageInput in the set. Prefers inputs with given tag.- Returns:
- the ImageInput
-
getSmallest
public ImageInput getSmallest()
Returns the smallest ImageInput in the set.- Returns:
- the ImageInput
-
getSmallestPreferred
public ImageInput getSmallestPreferred(ImageInput.InputTag tag)
Returns the smallest ImageInput in the set. Prefers inputs with the given tag.- Returns:
- the ImageInput
-
getHiresIterator
public ListIterator<ImageInput> getHiresIterator()
Get an Iterator for this Fileset starting at the highest resolution image.- Returns:
- the Iterator
-
getLoresIterator
public ListIterator<ImageInput> getLoresIterator()
Get an Iterator for this Fileset starting at the lowest resolution images. The Iterator starts at the last element, so you have to use it backwards with hasPrevious() and previous().- Returns:
- the Iterator
-
getResX
public float getResX()
- Returns:
- the resX
-
getResY
public float getResY()
- Returns:
- the resY
-
setAspect
public void setAspect(ImageSize s)
Sets the aspect ratio from an ImageSize.- Parameters:
s
- the ImageSize
-
getAspect
public float getAspect()
Returns the aspect ratio. Aspect ratio is (width/height). So it's <1 for portrait and >1 for landscape.- Returns:
- the aspect ratio
-
checkMeta
public void checkMeta()
-
add
public boolean add(ImageInput f)
Adds an ImageInput to this ImageSet. The images should be added in the order of higher to lower resolutions. The first image is considered the hires "original".- Parameters:
f
- ImageInput to add- Returns:
- true (always)
-
append
public void append(ImageSet imgs)
Append all ImageInputs from another ImageSet (at the end). Changes the parents of the ImageInputs to this ImageSet.- Parameters:
imgs
- the ImageSet
-
-