[gdal-dev] Re: NITF JPEG2000 compression and Kakadu

Frank Warmerdam warmerdam at pobox.com
Wed Jan 13 11:47:12 EST 2010


Martin Chapman wrote:
> Frank,
> 
>  
> 
> In the file NITFDatasetCreate.cpp in the function NITFDatasetCreate() if 
> the compression option is set to C8 (JPEG2000) it looks like you:
> 
>    1. get a handle to an installed J2K driver if available.
>    2. test for metadata creation capability.
>    3. create the nitf file.
>    4. open a new handle to the nitf file on disk.
>    5. setup a j2k subfile option based on the new nitf file segment offset.
>    6. call create on the j2k driver with the j2k_subfile option.
>    7. return an open handle to the new nitf file.
> 
> It seems to me that I could hack my version of GDAL to include support 
> for doing this with my copy of Kakadu with the exception that I would 
> have to first create a VRT dataset of my output J2K file and then use 
> CreateCopy() on the Kakadu driver instead of Create().
> 
> Do you think I am missing something here and that it is more difficult 
> then that?  Does the Kakadu library not have some feature I would need 
> to do this?
> 
> If it can be done, would my approach of using a VRT dataset work?
> 
> I only want to create single dataset output.

Martin,

I have skimmed NITFCreateCopy() in nitfdataset.cpp, and I was somewhat
surprised to find it does not already support using the JP2KAK (kakadu)
driver to write jpeg2000 encoded nitf files.

I *think* it could be trivially extended to support JP2KAK with a case
similar to the one for JasPer with the filename encoded using the
/vsisubfile/ mechanism.

I must confess I'm not clear on why you are bringing VRT files or the
Create() method into the discussion.  Hmm, rereading your email...

I assume you are referring to the function NITFDatasetCreate() in
nitfdataset.cpp (not NITFDatasetCreate.cpp which I don't think exists).
I see it utilizes some special hacks taking advantage of the fact that
the JP2ECW driver supports create+write as long as the application writes
in a very specific top down order.  I had forgetting about this hack
which was implemented (somewhat against my better judgement) for
ERMapper.

Do you have a compelling need to support imperative creation via
Create() instead of CreateCopy()?  Feel free to give me a call at
+1 613 754-2041 if that would expedite this discussion.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list