Search in sources :

Example 1 with TreCollection

use of org.codice.imaging.nitf.core.tre.TreCollection in project alliance by codice.

the class TreUtilityTest method createFileHeader.

public static NitfHeader createFileHeader(DateTime fileDateTime) {
    TreCollection treCollection = new TreCollectionImpl();
    FileSecurityMetadata securityMetadata = createSecurityMetadata();
    NitfHeader nitfHeader = mock(NitfHeader.class);
    when(nitfHeader.getFileTitle()).thenReturn("TEST NITF");
    when(nitfHeader.getFileType()).thenReturn(FileType.NITF_TWO_ONE);
    when(nitfHeader.getComplexityLevel()).thenReturn(1);
    when(nitfHeader.getFileDateTime()).thenReturn(fileDateTime);
    when(nitfHeader.getOriginatingStationId()).thenReturn("LOCALHOST");
    when(nitfHeader.getStandardType()).thenReturn("BF01");
    when(nitfHeader.getFileBackgroundColour()).thenReturn(new RGBColourImpl((byte) 0, (byte) 0, (byte) 0));
    when(nitfHeader.getOriginatorsName()).thenReturn("");
    when(nitfHeader.getOriginatorsPhoneNumber()).thenReturn("");
    when(nitfHeader.getFileSecurityMetadata()).thenReturn(securityMetadata);
    when(nitfHeader.getTREsRawStructure()).thenReturn(treCollection);
    return nitfHeader;
}
Also used : RGBColourImpl(org.codice.imaging.nitf.core.impl.RGBColourImpl) NitfHeader(org.codice.imaging.nitf.core.header.NitfHeader) TreCollectionImpl(org.codice.imaging.nitf.core.tre.impl.TreCollectionImpl) FileSecurityMetadata(org.codice.imaging.nitf.core.security.FileSecurityMetadata) TreCollection(org.codice.imaging.nitf.core.tre.TreCollection)

Example 2 with TreCollection

use of org.codice.imaging.nitf.core.tre.TreCollection in project alliance by codice.

the class RoutingSlip method tresExist.

private Boolean tresExist(NitfHeader header) {
    TreCollection treCollection = header.getTREsRawStructure();
    List<Tre> mtirpbList = treCollection.getTREsWithName(MTIRPB);
    return !mtirpbList.isEmpty();
}
Also used : Tre(org.codice.imaging.nitf.core.tre.Tre) TreCollection(org.codice.imaging.nitf.core.tre.TreCollection)

Example 3 with TreCollection

use of org.codice.imaging.nitf.core.tre.TreCollection in project alliance by codice.

the class CatalogOutputAdapter method copySDEs.

private void copySDEs(TaggedRecordExtensionHandler in, TaggedRecordExtensionHandler out) {
    TreCollection treCollection = out.getTREsRawStructure();
    in.getTREsRawStructure().getTREs().stream().filter(this::isSdeTre).forEach(treCollection::add);
}
Also used : TreCollection(org.codice.imaging.nitf.core.tre.TreCollection)

Example 4 with TreCollection

use of org.codice.imaging.nitf.core.tre.TreCollection in project alliance by codice.

the class TreUtilityTest method createImageSegment.

public static ImageSegment createImageSegment(DateTime imageDateTime) {
    SecurityMetadata securityMetadata = createSecurityMetadata();
    ImageBand imageBand = createImageBand();
    ImageSegment imageSegment = mock(ImageSegment.class);
    TreCollection treCollection = new TreCollectionImpl();
    when(imageSegment.getFileType()).thenReturn(FileType.NITF_TWO_ONE);
    when(imageSegment.getNumBands()).thenReturn(3);
    when(imageSegment.getActualBitsPerPixelPerBand()).thenReturn(8);
    when(imageSegment.getIdentifier()).thenReturn("12345");
    when(imageSegment.getImageDateTime()).thenReturn(imageDateTime);
    when(imageSegment.getImageTargetId()).thenReturn(new TargetIdImpl());
    when(imageSegment.getImageIdentifier2()).thenReturn("");
    when(imageSegment.getSecurityMetadata()).thenReturn(securityMetadata);
    when(imageSegment.getImageSource()).thenReturn("");
    when(imageSegment.getNumberOfRows()).thenReturn(2048L);
    when(imageSegment.getNumberOfColumns()).thenReturn(2048L);
    when(imageSegment.getPixelValueType()).thenReturn(PixelValueType.INTEGER);
    when(imageSegment.getImageRepresentation()).thenReturn(ImageRepresentation.RGBTRUECOLOUR);
    when(imageSegment.getImageCategory()).thenReturn(ImageCategory.MULTISPECTRAL);
    when(imageSegment.getActualBitsPerPixelPerBand()).thenReturn(8);
    when(imageSegment.getPixelJustification()).thenReturn(PixelJustification.LEFT);
    when(imageSegment.getImageCoordinatesRepresentation()).thenReturn(ImageCoordinatesRepresentation.NONE);
    when(imageSegment.getImageCompression()).thenReturn(ImageCompression.NOTCOMPRESSED);
    when(imageSegment.getImageBandZeroBase(anyInt())).thenReturn(imageBand);
    when(imageSegment.getImageMode()).thenReturn(ImageMode.BANDSEQUENTIAL);
    when(imageSegment.getNumberOfBlocksPerRow()).thenReturn(4);
    when(imageSegment.getNumberOfBlocksPerColumn()).thenReturn(4);
    when(imageSegment.getNumberOfPixelsPerBlockHorizontal()).thenReturn(512L);
    when(imageSegment.getNumberOfPixelsPerBlockVertical()).thenReturn(512L);
    when(imageSegment.getImageDisplayLevel()).thenReturn(1);
    when(imageSegment.getAttachmentLevel()).thenReturn(2);
    when(imageSegment.getImageLocationRow()).thenReturn(0);
    when(imageSegment.getImageLocationColumn()).thenReturn(0);
    when(imageSegment.getImageMagnification()).thenReturn("1.00");
    when(imageSegment.getTREsRawStructure()).thenReturn(treCollection);
    return imageSegment;
}
Also used : ImageSegment(org.codice.imaging.nitf.core.image.ImageSegment) ImageBand(org.codice.imaging.nitf.core.image.ImageBand) TargetIdImpl(org.codice.imaging.nitf.core.image.impl.TargetIdImpl) TreCollectionImpl(org.codice.imaging.nitf.core.tre.impl.TreCollectionImpl) SecurityMetadata(org.codice.imaging.nitf.core.security.SecurityMetadata) FileSecurityMetadata(org.codice.imaging.nitf.core.security.FileSecurityMetadata) TreCollection(org.codice.imaging.nitf.core.tre.TreCollection)

Example 5 with TreCollection

use of org.codice.imaging.nitf.core.tre.TreCollection in project alliance by codice.

the class TreUtilityTest method createFileHeaderWithMtirpb.

public static NitfHeader createFileHeaderWithMtirpb() throws NitfFormatException {
    NitfHeader nitfHeader = createFileHeader();
    TreCollection treCollection = nitfHeader.getTREsRawStructure();
    treCollection.add(createMtirpbTre());
    return nitfHeader;
}
Also used : NitfHeader(org.codice.imaging.nitf.core.header.NitfHeader) TreCollection(org.codice.imaging.nitf.core.tre.TreCollection)

Aggregations

TreCollection (org.codice.imaging.nitf.core.tre.TreCollection)5 NitfHeader (org.codice.imaging.nitf.core.header.NitfHeader)2 FileSecurityMetadata (org.codice.imaging.nitf.core.security.FileSecurityMetadata)2 TreCollectionImpl (org.codice.imaging.nitf.core.tre.impl.TreCollectionImpl)2 ImageBand (org.codice.imaging.nitf.core.image.ImageBand)1 ImageSegment (org.codice.imaging.nitf.core.image.ImageSegment)1 TargetIdImpl (org.codice.imaging.nitf.core.image.impl.TargetIdImpl)1 RGBColourImpl (org.codice.imaging.nitf.core.impl.RGBColourImpl)1 SecurityMetadata (org.codice.imaging.nitf.core.security.SecurityMetadata)1 Tre (org.codice.imaging.nitf.core.tre.Tre)1