// Copyright (C) 1999-2018 // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" #include "fitsimage.h" #include "compress.h" #include "rice.h" #include "gzip.h" #include "hcompress.h" #include "plio.h" void FitsImage::initCompress() { int bitpix = fits_->getInteger("ZBITPIX",0); char* type = fits_->getString("ZCMPTYPE"); if (!bitpix || !type) return ; if (post_) delete post_; post_ = NULL; if (!strncmp(type,"RICE_1",6) || !(strncmp(type,"RICE_ONE",8))) switch (bitpix) { case 8: post_ = new FitsRicem(fits_); break; case 16: post_ = new FitsRicem(fits_); break; case -16: post_ = new FitsRicem(fits_); break; case 32: post_ = new FitsRicem(fits_); break; case 64: post_ = new FitsRicem(fits_); break; case -32: post_ = new FitsRicem(fits_); break; case -64: post_ = new FitsRicem(fits_); break; } else if (!strncmp(type,"GZIP_1",6) || !strncmp(type,"GZIP_2",6)) switch (bitpix) { case 8: post_ = new FitsGzipm(fits_); break; case 16: post_ = new FitsGzipm(fits_); break; case -16: post_ = new FitsGzipm(fits_); break; case 32: post_ = new FitsGzipm(fits_); break; case 64: post_ = new FitsGzipm(fits_); break; case -32: post_ = new FitsGzipm(fits_); break; case -64: post_ = new FitsGzipm(fits_); break; } else if (!strncmp(type,"PLIO_1",6)) switch (bitpix) { case 8: post_ = new FitsPliom(fits_); break; case 16: post_ = new FitsPliom(fits_); break; case -16: post_ = new FitsPliom(fits_); break; case 32: post_ = new FitsPliom(fits_); break; case 64: post_ = new FitsPliom(fits_); break; case -32: post_ = new FitsPliom(fits_); break; case -64: post_ = new FitsPliom(fits_); break; } else if (!strncmp(type,"HCOMPRESS_1",11)) switch (bitpix) { case 8: post_ = new FitsHcompressm(fits_); break; case 16: post_ = new FitsHcompressm(fits_); break; case -16: post_ = new FitsHcompressm(fits_); break; case 32: post_ = new FitsHcompressm(fits_); break; case 64: post_ = new FitsHcompressm(fits_); break; case -32: post_ = new FitsHcompressm(fits_); break; case -64: post_ = new FitsHcompressm(fits_); break; } else { ; // unknown compression type } return; }