-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use openjpeg instead of nanojpeg if found #8
Comments
Is there a specific problem with nanojpeg and Fedora? As I note, I include nanojpeg and this can convert classic JPEG-compressed DICOMs. I regularly compile dcm2niix on the Fedora-based CentOS and have never seen a problem. The user can also choose to compile to the Jasper or OpenJPEG libraries to add JPEG 2000 support, though the executable size grows a lot. In my experience JPEG 2000 is VERY rare in medical imaging. It is lossy. While the classic JPEG can lead to visible artifacts, the artifacts from JPEG 2000 can be subtle but are often precisely in the textures radiologists use to identify pathologies. |
There is problem with bundling libraries. I already included openjpeg for building, but it still uses nanojpeg for one function and I want to get rid of it. |
OK, fine. Are you confident that your changes will not cause problems for Debian based builds? -c |
I will add some if statements into cmake and it will work fine. |
So please prepare replacement of current nanojpeg code using openjpeg and I will prepare cmake stuff and you will able to use nanojpeg or openjpeg ( I will use for official package second). |
Hello http://www.openjpeg.org |
I also note you have been working on the rather ancient debian branch, rather than the current master branch. Can I suggest you try out the current master branch? As listed on the home page, compiling with both ujpeg (for classic JPEG) and OpenJPEG (for JPEG2000) is pretty easy. If you want to tune make files for Fedora and the master branch I would be happy to include them. In any case, here is a typical (clang) compilation to include OpenJPEG: g++ -O3 -dead_strip -I. main_console.cpp nii_dicom.cpp nifti1_io_core.cpp nii_ortho.cpp nii_dicom_batch.cpp jpg_0XC3.cpp ujpeg.cpp -o dcm2niix -I/usr/local/lib /usr/local/lib/libopenjp2.a |
Has this been effectively solved in the end? Is there a way to select the system jpeg libraries instead of the vendorized nanojpeg for the build? |
Looks like your patch unbundles |
@ghisvail yes, and as far as I can see it's merged in this repository, so I think master branch should have it (if it was not reverted) |
I don't think it has been merged in Perhaps an improvement over your patch would be to declare corresponding use flags ( |
it definitely was merged in #6. Weird thing is that I can find in git-log my commit, but I can't see any commits which would remove it.... |
@neurolabusc Any ideas? |
Well, the license stuff were merged indeed. Did you submit a PR for the unbundling? |
FYI, the reason I bumped this issue up is because I am also interested in using less of the vendorized code for the Debian package, at the very least for the JPEG dependency (for which we get security problems very often). |
@ghisvail yeah, I missed updates for Fedora package for long time, so I didn't notice. but some comment from @neurolabusc would be very useful.. The cmake/Modules just disappeared somehow. |
I would be happy to support patches for the master branch. As I recall, the patches were for a Debian branch that I do not support. 1.) I did enable using 2.) As I noted, 3.) You could certainly update the patch to support |
It is a good start, but it would be better to have it integrated in CMake, hence my proposal of adding a configuration flag to choose whether to use the embedded
What about
Indeed, although the vendorization of Nifti in the
Yes |
|
I did take a look at the code, and I think it is not a good idea to use |
Our motivations for not using the vendorized code in the packaged version of What @ignatenkobrain and myself are investigating here is a way to support both your code path using the vendored dependencies and an alternative which could make the most of the packaged system libraries. It does not have to be one or the other, that's what I am saying. |
As I noted, the code from nifticlib is a couple of small, mature math routines and the names of the structures. These functions are not security risks. I do think you could break my unit up into two: one with the copies from nifticlib and another with the extensions I added, but I do think you will hurt the readability and maintainability of the code base: all of those functions and structures belong together. I think your goal is laudable for things like JPEG decompression, where there are concerns regarding buffer overflow and other IO issues. However, I do not use any of the nifticlib input/output routines that would raise these concerns. |
1.) I did update the CMake file, so it will build to zlib instead of miniz if it detects the zlib package. Please test this out and confirm it works. 2.) I do think a developer could replace nanoJPEG with |
Just to be clear, my earlier comment was only meant to explicit our motivations and make sure we were all on the same page. From a pragmatic standpoint, I completely agree with you that the vendorized subset of
👍
That would be the plan.
Thanks for the pointer. |
1.) I have updated the code to optionally use libjpeg-turbo instead of nanojpeg. This is described in the 2.) I am not very familiar with cmake files, so I suggest you update that to use the 3.) The code also contains a couple of verbose printf comments for use while testing this - we can remove those before a general release. 4.) Once this is done, I think we can close this issue. |
I'll look it up. Thanks for investigating.
I can provide a patch for the CMake integration once 1) is validated. |
I guess this issue can be closed now. The build system now supports compilation and linkage with the system |
It will make possible to package dcm2niix in Fedora.
The text was updated successfully, but these errors were encountered: