Skip to content

Commit

Permalink
Merge pull request #787 from jonclayden/divest-1.0
Browse files Browse the repository at this point in the history
Changes from divest v1.0
  • Loading branch information
neurolabusc committed Feb 14, 2024
2 parents 96bb7ac + f5852a1 commit 464cbeb
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 190 deletions.
19 changes: 18 additions & 1 deletion console/nii_dicom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3152,12 +3152,25 @@ unsigned char *nii_byteswap(unsigned char *img, struct nifti_1_header *hdr) {

#ifdef myEnableJasper
unsigned char *nii_loadImgCoreJasper(char *imgname, struct nifti_1_header hdr, struct TDICOMdata dcm, int compressFlag) {
#if defined(JAS_VERSION_MAJOR) && JAS_VERSION_MAJOR >= 3
jas_conf_clear();
jas_conf_set_debug_level(0);
jas_conf_set_max_mem_usage(1 << 30); // 1 GiB
if (jas_init_library()) {
return NULL;
}
if (jas_init_thread()) {
jas_cleanup_library();
return NULL;
}
#else
if (jas_init()) {
return NULL;
}
jas_setdbglevel(0);
#endif
jas_stream_t *in;
jas_image_t *image;
jas_setdbglevel(0);
if (!(in = jas_stream_fopen(imgname, "rb"))) {
printError("Cannot open input image file %s\n", imgname);
return NULL;
Expand Down Expand Up @@ -3284,6 +3297,10 @@ unsigned char *nii_loadImgCoreJasper(char *imgname, struct nifti_1_header hdr, s
jas_matrix_destroy(data);
jas_image_destroy(image);
jas_image_clearfmts();
#if defined(JAS_VERSION_MAJOR) && JAS_VERSION_MAJOR >= 3
jas_cleanup_thread();
jas_cleanup_library();
#endif
return img;
} //nii_loadImgCoreJasper()
#endif
Expand Down
Loading

0 comments on commit 464cbeb

Please sign in to comment.