c++ - Load gzip compressed nifti file -
i using template image processing library, found here, reading nifti files works great. problem is, nifti files gzip compressed. files example.nii.gz. idea use boost lib, found here, reading , uncompressing files , pass uncompressed file nifti reader. unfortunately sounds easier is.
so here code reading gz file:
using namespace std; ifstream file("example.nii.gz", ios_base::in | ios_base::binary); filtering_streambuf<input> in; in.push(gzip_decompressor()); in.push(file); boost::iostreams::copy(in, cout);
and file reader nifti lib:
copyright (c) 2010, fang-cheng yeh. rights reserved. std::auto_ptr<input_interface> input_stream; input_stream.reset(new input_interface); if (!input_stream->open(pfile_name)) { input_stream.reset(0); return false; } input_stream->read(&header,sizeof(header));
instead of opening file in file reader of nifti lib, use uncompressing code boost. how data filtering_streambuf (boost lib) input_stream (nifti lib)? or maybe has idea how read nii.gz file other libs?
Comments
Post a Comment