You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been exploring the test_make_nitf.py script located in modules/python/nitf/samples to understand how to create NITF files programmatically. While we've successfully managed to incorporate the file header, image segment, and various TREs, we're encountering difficulties integrating Data Extension (DES) and Text Segments into the NITF file.
TEXT SEGMENT
For the text segment, we created a new TextSegment and added the subheaders in the same manner. We then created an instance of SegmentWriter for our text segment.The next issue we face is unclear: how to add our text data into this text segment.
Python script
text_segment=record.newTextSegment()
if'text'inself.fieldmap:
forfield, valueinself.fieldmap['text'].items():
iffieldintext_segment.subheader:
text_segment.subheader[field] =valuesegmentwritter_0=SegmentWriter(text_segment)
segmentwritter_0.attachSource("Sample String for text segment")
Error message
Exception has occurred: AttributeError
'str' object has no attribute 'ref'
File "/mnt/c/Users/bsamrat/Desktop/test-4/snip/lib/python3.10/site-packages/nitf/__init__.py", line 1254, in attachSource
val = nitropy.nitf_SegmentWriter_attachSource(self.ref, source.ref, self.error) == 1
File "/mnt/c/Users/bsamrat/Desktop/test-4/test3.py", line 128, in make_image_nitf
segmentwritter_0.attachSource("Sample String for text segment")
File "/mnt/c/Users/bsamrat/Desktop/test-4/test3.py", line 197, in <module>
generator.make_image_nitf()
AttributeError: 'str' object has no attribute 'ref'
DATA EXTENSION SEGMENT
For the data extension segment, we created a new DESegment and added the subheaders similarly. We then created an instance of SegmentWriter for our data extension segment.Our next challenge is understanding how to correctly add DES. We attempted to add a TRE, such as CSEPHA, into this segment instead of a DES, such as CSEPHB. However, this approach is likely incorrect, as TREs and DESs are fundamentally different.
We've been exploring the
test_make_nitf.py
script located inmodules/python/nitf/samples
to understand how to create NITF files programmatically. While we've successfully managed to incorporate the file header, image segment, and various TREs, we're encountering difficulties integrating Data Extension (DES) and Text Segments into the NITF file.TEXT SEGMENT
For the text segment, we created a new TextSegment and added the subheaders in the same manner. We then created an instance of SegmentWriter for our text segment.The next issue we face is unclear: how to add our text data into this text segment.
Python script
Error message
DATA EXTENSION SEGMENT
For the data extension segment, we created a new DESegment and added the subheaders similarly. We then created an instance of SegmentWriter for our data extension segment.Our next challenge is understanding how to correctly add DES. We attempted to add a TRE, such as CSEPHA, into this segment instead of a DES, such as CSEPHB. However, this approach is likely incorrect, as TREs and DESs are fundamentally different.
Python script
Json file
Error message
The text was updated successfully, but these errors were encountered: