Category Archives: development

Now working on R* S1 FW Writer for Mac OS X.

For some people to waited for long, it will comes out soon what about firmware upgrading program for Mac OS X. Now I am working on it in Linux and Mac OS X by my multi-platform availed libraries.

Wait for more days, it will release on manuafacturer home page, and you will be happy.

Here’s old version of developing of GUI sequence, you may hope this graphics may exactly same on Mac OS X. (even more faster and smooth !)

sset to C or H converting open source.

There’s nothing to find information about sset ( I was misunderstood it may s-record ), so I made a simple tool for supporting multi-platform if have any GCC with STL.

You can clone or download source code ( it is MIT license ) and build in your system with just typing “make” then, enjoy it.

It was tested on Windows MinGW-W64 and Mint Linux 18.2 GCC 5.2 with Mac OS X llvm-gcc. You can change {anyname of file}.sset to C or H file with options here:

For example, let converting preview.sset file to cam_previewmode.c,

sset2c preview.sset -s=cam_preview_1080p -t=msm_camera_i2c_reg_array cam_previewmode.c

You can decide symbol name and structure name ( you may know what structure name to be written before understanding platform driver structures ) by making a converted file.

And result is like this,

You can simply changes many register setting arrays at once with my open source code here:

Experience of Intel HD 630 damn driver.

I guess some people may experienced badness of Intel something – as like old models from Intel graphics as known thousnad numbered models – HD 2000 or 3000 whatever, when specially upgraded to Windows 10 from older.

My new office desktop presented to me a bad experience about mouse cursor doesn’t applying anti-aliased shape, and also without shadow in 2017 !

I had to find solve this Paleolithic lacks come in modern life, searched in Godgle, and finally found a word – “INSTALL NEW DRIVER”.

Yes, it was may a SMALL problem of Intel as like before, alwasy like that. Now I can see smoothen customized mouse cursor after new driver installed ( build 4678 ).

If you are looking bad shaped mouse cursor and if it belong to your internal video adaptor – yes, you may saved money to buy external graphic deivce as like AMD R460 or nVidia 1060 whatever – check for new video device driver asap, but you don’t sens what is wrong, also may nor required check update from big blue bad brother who named Intel.

CLAHE shading correction

Applying CLAHE to medical images may going to some shaded on each edge side of object. So I have to correct this problem with fast processing in real time.

To make up a prototype correction, I have used same source RAW image, here is a source image in down scaled from 16bit gray scale RAW.

Applied CLAHE with 16×16 in clip limit of 100.0f. And I could recognized shaded areas at each edge of object. Shaded area marked as red boxes in below.

To correct shaded area, generate gaussian blur mask with big radials, but it really heavy to processing in fast time as realtime. So I made it fastest way with my ‘Resize engine’ that made with OpenMP and AVX instructions. To generate fastest blurred mask, down scale with bi-linear filter to 2.5% size. Then doing up scale again with B-Spline filter to original size. And Invert it.

Then calculate to do shade correction with generated shade mask, ins fastest math functions with original image.

To complete image processing, need to fill background areas.

It simply corrected but little bit lacks on details of bone level. But definitely better than hard shaded levels after window leveling. Expect for next will find more improved processing algorithm, and it will be a function of librawprocessor.

Correcting shaded illumination on medical image.

By using CLAHE algorithm, there’s some problem occurs by object shapes like this:

Each edge side of object going too darken by window leveling. It is defecting issue of CLAHE. So I tried to make it corrected with shading correction.

Here is source raw image, 14bit gray.

First, I need make a background mask to overriding changed level after CLAHE.

It can generate simply by using my librawprocessor. Then I applied CLAHE, 10×10, 30.0f.

Shadowed or shaded areas occurs after applying CLAHE, it must be corrected. So I made shaded map with my fast resize engine. Down scale to 10% of original image size with Bi-Linear filter, then up scale again with B-Spline filter with inverse.

It is much effective than Gaussian blur. Very fast but similar to Gaussian blurred. almost realtime in 3000×3000 array with floating point  levels in AVX and OpenMP optimization.

Now I am just add masked shade map level with exponential to original image.

Result is :

Shaded object areas seems to enhanced than before. So I continued to applying background mask.

Ok, then I made it to window leveled.

Each edge sides are not seems to much shaded than before. It should be better than applying single CLAHE. I will continue to write more effective image processing with CLAHE.

My some GitHub sources updated for Linux.

It was long time to boot my Linux laptop for a while. And updated almost of my GitHub source codes to work on Linux, too. Actually I just cared about Windows and Mac OS-X, except my old friend Linux.

But now, almost of source codes may works on Makefile.{platform} name, then it will be need copy Makefile.{platform} to Makefile.

Ok, It’s time to step for next, some GUI programs to make it works almost of platforms like Linux and MacOS-X.

tinydicom + rawprocessor lesson #2

Now it’s time to next step for using my open sources,  And here I like to introduce how loads DCM and what it contains inside tags.

Just read my example code to read DICOM tags from DCM file, it should help what inside.

It may compiles with libtinydicom.a linkage as well, just compile your code with -ltinydicom -L{libtinydicom.a directory from your path}. Or, just follow my way – Make an empty directory in your working directory –  I like to recommend to make a directory as like ‘projects’. Then make a new again for unique name to check for next time, or continue to more works : recommend ‘dcmtest1’ or ‘dcmtest2’. So you may now placed to {Your home directory}/projects/dcmtest1 when you had followed my recommendation. Now make a empty cpp file with any editor like vim, then copy & paste my example, then save it up and quit editor. Then copy prebuilt “libtinydicom.a” and “libdcm.h” into your current directory – if you didn’t prebuilt? just build it first. and type like this.

g++ main.cpp -ltinydicom -o test1

You may check test1 or test1.exe (on Windows).
Now you need download sample DCM file from here:

SMPTE & SIMFIT

If you have wget, you can do :

wget http://tomintechsupport.com/download/SIMFIT.dcm

Now you have SIMFIT.dcm and compiled binary with same directory. Just type your binary name. And check result. 87 items may displayed with sizes.

 

Then, try to next step, save raw pixel image to a new file. See my example source.

Now you need prebuilt librawprocessor.a and rawprocessor.h file in your directory with example source code. It proceeds read SIMFIT.DCM and export pixel image information, then writes to a file.

Important points is ‘Checking Window center and width’ from DICOM tag ID 0028:1050 and 0028:1051. These tags contains information of window center and width, and it must applied to exported image. So I used Get16bitThresholdedImage() method to make windowed image.

If you need more detailed? just let left a guestbook here.

Next lesson may using libPNG, and make raw image to 8bit grey scaled image to see in common image viewing programs.

tinydicom + rawprocessor lesson #1

Here I planned to write some lessons to understand what is libtinydicom (Tiny DICOM library) and librawprocessor (RAW Processing library) for most of modern compilers except M$VC – unfortunately I am sorry about supporting M$VC, but I don’t like care about distinct, banishing standard compiler.

Ok, let understand what is each library doing what it does and what it existed for.

libtinydicom

This library was born to read and write DICOM tags in a file by myself. At a time I made this, there’s some commercial libraries and open source too – A.K.A DCMTK. I was just wanted to write simply some DICOM tags and also reads Pixel datas from any DCM files – so I have started to read NEMA’s DICOM standards. And it was about 2011.

It passed years and continuously made it works well with many different DCM files, and now it availed to as an open source on GitHub.com.

Anyone can clone or download source code and use it for freely with small license MIT. Just Ok for announcing what you used it your project or product.

Supported compilers are most of modern C++ compiler supporting Makefile. It made with MinGW-W64 and Code::Blocks IDE, but now supporting Mac OS-X and Linux too because it made only with C++ STL.

How to use it ?

Simply you can download source code as ZIP compression from here. And you may need already know how I can extract ZIP file to somewhere, and plus more you must know what I have to use compiler with this library – If don’t know? Just, please, don’t try to use it, It may difficult to understand next jobs.

Now choose one of Makefiles that have extensions – gcc and llvm.  Just copy one Makefile.{your compiler to use} to Makefile as like cp Makefile.gcc Makefile and then, just type to make.   If it succeed to build all sources, you can see a lib directroy, and there’s two files : libtinydicom.a and libdcm.h

And now you may understand how it be used, and this lesson may continued to next.

 

librawprocessor

librawprocessor born to doing something for most of medical RAW images. It supports read and write, rotating, flip, convert to 8 bit image and more features.

You can download or clone source codes here.

“librawprocessor” supports OpenMP for processing image quickly if your compiler supports this feature. Most of processing features are optized for OpenMP and AVX instruction.

Features:

  • Load from File, Memory.
  • Save as a new RAW image.
  • Flip vertical, horizontal
  • Fast Rotate 90, 180, 270 degrees
  • Free Rotate in 0 to 359.99 degrees
  • Change width and height in size of height, to recognize what resolution is right.
    ( Most medical RAW images has no information about sizes )
  • Invert
  • Rescale with many filters : Bilinear, Bicubic, B-Spline, Lanzcos
  • Kernel matrix filtering : sharpen, blur or customized
  • Brightness, Contrast, Gamma adjustment
  • Tone mapping with Drago and Reinhard
  • CLAHE
  • Generate low frequency image and anisotropic filtered image from source
  • Advanced edge enhace
  • Automatic weight calculation ( window width )
  • Get down scaled pixel ranged data from source ( thresholding to any bits, 8 or 16bits )

How to use it ?

Simply you can download or clone from here. You may need prepared to understand what is your compiler and how to build with Makefile. ( M$VC not an option, sorry about this but no plan to future, too ) Tested almost of GCC environments : Windows, Mac OS-X, Linux.

After you got source code on your system, copy your right Makefile.{compiler type you have} to Makefile as like this : cp Makefile.gcc Makefile , then proceed simply make. And you can decide to use OpenMP option with appends a word openmp to make.

Required OpenMP is at least 3.0 or above. lower version may reason of compile failure.

And now you may understand how it be used, and this lesson may continued to next, too.

An open source graphical help tool library, fl_imgtk.

Here is an open source library helps many Fl_RGB_Image processing to make some featured GUI.  You can clone or download source code in free on GitHub page.

It designed to work with any type of gcc ( llvm-gcc and MinGW-W64 ) with just a copy and type ‘make’, or modify Makefile.{your compiler} and copy to it as Makefile, then it could be compiled and writes libfl_imgtk.a into “lib” directory includes fl_imgtk.h.

What you can do ?

It provides some features to processing Fl_RGB_Image as like Photoshop.

  • Flip image in vertical or horizental.
  • Rotate image in any degree with smoothen pixels.
  • Adjusting contrast, bright and gamma.
  • Drawing image to blurred ( by using fl_smimg rescaling ).
  • Rescale with muliple filters ( nearest, bilinear, bicubic, lanczos, b-spline )
  • Tone mapping ( HDRi ) with two different algorithms : Drago and Reinhard ( refered to FreeImage3 )
  • Kernel matrix filtering ( basically supports blur, blur more, sharpen, sharpen more filters)
    Specially any user can make a new kernel filter easily.
  • Draw Fl_Widget to Fl_RGB_Image
  • Draw Fl_Widget to blurred Fl_RGB_Image as it could be used in cool background.
  • Cropping image to a part of new image.

Building

Before you start with this open source library, prepare what FLTK library compiled or installed in your system. I amd working my clone version of FLTK 1.3.4-1.

First you need to do, download or cloen with your git into your working directoy. Then, copy Makefile.{your compiler} to Makefle. ( ex, cp Makefile.gcc Makefile )

Now just proceeding make.

If you faced to unknown reference of FLTK libraries, you may need edit Makefile.

You can changes FLTK_xxx configuration to your right place. It will works well any platform that availed to compile FLTK library.

Any question ?

You can make a new issue on my GitHub page, or my Guest book on my blog.

 

License

  • MIT License

 

External Licenses

  • FLTK license
  • FreeImage (3) license.