Reduce bundle size
Lots of code from THREEJS is not shaked-out and OpenJPEG is way too big.
> yarn analyze:ami:prod

https://github.com/FNNDSC/ami/pull/326
Pako is being included 2 times. (-200kB)
OpenJPEG is huge. Can we get rid of JPX/JPEG decoder then?
Freesurder segmentation preset should not be part of the bundle. (-100kB)
OpenJPEG can be excluded from package. If users want to work with J2K, AMI documentation will force them to load OpenJPEG script before AMI, like it done in Cornerstone.
Interesting - do you have a link to where they would do in Cornerstone?
In AMI, the data "parsers" and "decoders" is the most expensive thing
https://github.com/cornerstonejs/cornerstoneWADOImageLoader/blob/master/docs/Codecs.md https://rawgit.com/cornerstonejs/cornerstoneWADOImageLoader/master/examples/dicomfile/index.html L112-L133
Thanks that's useful!
What I am thinking now is that: 1- load all codecs on demand in ami (somehow)
// in dicom parser
if (j2k) {
// get j2k decoder through ajax file, then when loaded, continue
}
or 2- provide codecs in the loader/parser constructors
const volumeLoader = new VolumeLoader({
decoders:
{
j2k: J2K, // J2K constructor
}
})