MIRTK icon indicating copy to clipboard operation
MIRTK copied to clipboard

Support JPEG image file format

Open Phoebegit opened this issue 6 years ago • 4 comments

Hi, I'm a new MIRTKer,

Few days age, I just install MIRTK in ubuntu, I made install the\Example\helloworld\ flip.cc and generated flip.exe.

when I ran a code in terminal : flip testgray.jpg laa.jpg , there was a error :`ImageReader::New: Unsupported file format or image reader not available for: testgray.jpg' . BTW, the testgray.jpg has been placed st the current directory. image

So, this error make me doubt whether I installed MIRTK successfully? or Dose this function flip really has some requirements for image format?

Thanks very much!

Phoebegit avatar Nov 20 '19 03:11 Phoebegit

Welcome to MIRTK!

It seems you installed the toolkit successfully (for runtime efficiency, I suggest you check that WITH_TBB was set to ON in CMake).

As the toolkit was mostly applied to medical image volumes, it only supports PNG as output image format for screenshots. Support for JPEG is currently missing. If you have an interest in it, we could consider adding it. Otherwise, you may convert your images to the MetaImage file format, support for which I added just this week and pushed today. For the conversion, I suggest you have a look at SimpleITK. The main file format used by MIRTK is NIfTI.

import SimpleITK as sitk
sitk.WriteImage(sitk.ReadImage("testgray.jpg"), "testgray.mha")

A note on installation, unless you are planning to extend MIRTK, but are mainly interested in executing its binary tools and are working on Linux (e.g., Ubuntu), you can also install the latest MIRTK version with a single command without source code compilation:

The current latest release build from master is:

wget -O mirtk 'https://bintray.com/schuhschuh/AppImages/download_file?file_path=MIRTK-2.1-pre1-x86_64-glibc2.14.AppImage' && chmod +x mirtk

You can then run the MIRTK commands as follows:

./mirtk flip-image input.mha output.mha -x

schuhschuh avatar Nov 22 '19 14:11 schuhschuh

Hi schuhschuh, Thanks very much for your patient explanation. Your reply give me a lot of inspirations. Finally, I ran the example successfully by AppImages. And your explanation on the image format is very clear.

Phoebegit avatar Nov 25 '19 08:11 Phoebegit

Maybe We can close the issue?

Phoebegit avatar Nov 25 '19 08:11 Phoebegit

Glad the information was useful.

I will keep this issue in the backlog for now as reminder to add support for JPEG.

schuhschuh avatar Nov 25 '19 09:11 schuhschuh