use of nitf.BandInfo in project imageio-ext by geosolutions-it.
the class NITFImageWriter method setImageBands.
private static void setImageBands(final ImageSubheader subheader, final ImageWrapper imageWrapper) throws NITFException {
BandInfo[] bandInfos = null;
final ImageBand[] bands = imageWrapper.getBands();
if (bands == null || bands.length == 0) {
throw new IllegalArgumentException("ImageBands must be specified");
}
subheader.createBands(bands.length);
bandInfos = subheader.getBandInfo();
for (int i = 0; i < bandInfos.length; i++) {
BandInfo bandInfo = bandInfos[i];
NITFUtilities.setField("IREPBAND" + i, bandInfo.getRepresentation(), bands[i].getRepresentation());
// ISUBCAT shouldn't be null for MultiSpectral Imagery
NITFUtilities.setField("ISUBCAT" + i, bandInfo.getSubcategory(), bands[i].getSubCategory(), imageWrapper.getImageCategory() == Category.MS);
NITFUtilities.setField("IFC" + i, bandInfo.getImageFilterCondition(), NITFUtilities.Consts.NONE);
NITFUtilities.setField("NLUTS" + i, bandInfo.getNumLUTs(), NITFUtilities.Consts.ZERO);
}
}