Dicom Images non square - c#

I'm working with a set of DICOM images that are 512(columns) X 384(rows)
Is there a tool that would make the images 512X512? That is, filling the rows in this case to make it 512.
I've researched VTK with no luck.
Thanks!

Argh, you was almost there! In fact, VTK is not the proper tool for that. ITK is.
To be precise, VTK is for 3D visualization (that is, rendering of 3D objects), while ITK is specifically concerned for image processing.
So, using ITK, you could use a padding filter, here's a complete example from the official wiki, ready to be compiled and executed: http://public.kitware.com/pub/itk/Examples/src/Filtering/ImageGrid/PadAnImageWithAConstant/Documentation.html.
But, if you want to do the things in an easier way, I suggest MATLAB (ITK could be difficult to configure). In this case, this post could help: Padding an image in MATLAB.
Good luck!

Related

How to convert GDI+ GraphicsPath to HTML5 canvas Path?

Is there a library that would help to convert GDI+ GraphicsPath to HTML5 canvas Path? Or do I have to manually run through all GraphicsPath.PathPoints and GraphicsPath.PathTypes to emit corresponding HTML5 code (if so please share any hints)?
Unfortunately I couldn't find anything useful. Some people suggested using SVG as a way to "transport" curves from GDI to Canvas, but I couldn't find any decent SVG library for .NET. It took me quite some time to understand how the data inside GraphicsPath is stored because it is not as straightforward as you might think. This is what I've came up to.
Knowing how GraphicsPath actually work I've managed to recreate it using bunch of HTML5 functions: .moveTo(), .lineTo() and .bezierCurveTo(). The result was pretty neat although final string building takes some time and resulting JS files sometimes contain tenths of thousands lines of code if source GraphicsPath represents long text written with fancy font. Surprisingly Firefox handles them without problems.
I won't paste the code that I'm using as it is nothing special as long as you read and understand my answer from another SO question.

recognizing letter in image OCR

i searched with no result. If i copy other topic, please delete, not making mess.
I have question about image recognition OCR using C#
I am working on image which shows the scrabble.
First i converted image to grayscale, thresholded to find out only black letters and then I used median to avoid the walls around letters.
Now, how to start to get at the end function which will recognize letter? Should i somehow now separate 'foreach' letters :-) or just start recognizing ? On what problem should i take attention before start recognizing? Any sources will be welcome. :-)
Any idea will be also very helpful.
Well, this is a big, vast discussion...
If you don't want to reinvent the wheel, I suggest you use Tesseract, an open source OCR in C++, or Tessnet2 which is a .NET wrapper around it.
I had the same approach as yours, i.e. grayscale then thresholds etc in .NET, then I adapted a bit Tesseract (Tessnet2 is a wrapper around Tesseract 2.0, not 3.x which is the actual version) to have a good interface for OCR output then I have good results.
Here is another subject on OCR and Tesseract on Stack Overflow which describes more precisely what it consists in.
Of course if what you want is play with OCR concepts to make them work by yourself, this is not the good way :-)

Decoding a PCX image in c# to display as bitmap

I have been trying to create a decoder that will stream through a pcx file and display it on screen as a bitmap. I have managed to get the information from the image header by using a binary reader, but I have now reached the part that seems to take the least amount of code, yet is also the hardest: creating an array of pixels.
I understand that i may need to add two embeddded for loops to process the data. I have looked at some C and C++ examples, but struggle to understand them. I also need to get the array to display it. if you need more code then I will share it.
I have searched far and wide and read the spec, but I don't know how to approach this. If anyone could help me, I would be very grateful.
Regards.
The .NET does not support PCX images natively, you have two choices. Read the specification and decode the image by yourself or use some library.
As suggested on bytes.com you can use Dot Net Fireball (a Free Image wrapper) and load the image like this:
Fireball.Drawing.FreeImage freeImage = new FreeImage(#"c:\test.pcx");
Image image = freeImage.GetBitmap();
http://magick.codeplex.com/
a nice wrapper working with http://imagemagick.codeplex.com/
easy to setup and get going, see samples at the bottom of the page here:
http://magick.codeplex.com/documentation

Read data from a Gif

i have a requirement to read data from a gif. The gif is exported from a Bloomberg terminal and contains Stock Prices. Is there anyway of reading the Stock Prices off this gif?
I'd prefer to do it in C#, but if there is any other programming language that is recommended, i would be grateful if you can share that with me.
regards
A GIF is a graphic file. The only way to read data from it would be to use some form of OCR.
These software packages/libraries usually aren't free, but you could look at FreeOCR and try out what's there. Or look at the Tessnet2 Tesseract .NET library (most of the free/open source OCRs use the Tesseract engine).
I also feel compelled to point out that this is probably violating some sort of license agreement or TOC. Even if it isn't, you'd have a hard time guaranteeing any sort of accuracy for the information, and inaccuracy is an extremely bad thing when you're talking about stock prices. Be careful.
This sounds very dodgy to me. You would have to:
Have a high enough resolution such that optimization of the gif doesn't cause you to loose accuracy
You would have to use edge and corner detection to re-plot the time series / line from the gif. This is inherently inaccurate
You would have to now relative price/time for the gif dimensions. If this changes between gifs then forget it. Reading the values on the side/bottom would be a nightmare.
In short, find another source of data would be my recommendation. Image analysis on a gif to produce financial information isn't exactly a FIX update

Locating Text within image

I am currently working on a project and my goal is to locate text in an image. OCR'ing the text is not my intention as of yet. I want to basically obtain the bounds of text within an image. I am using the AForge.Net imaging component for manipulation. Any assistance in some sense or another?
Update 2/5/09:
I've since went along another route in my project. However I did attempt to obtain text using MODI (Microsoft Office Document Imaging). It allows you to OCR an image and pull text from it with some ease.
This is an active area of research. There are literally oodles of academic papers on the subject. It's going to be difficult to give you assistance especially w/o more deatails. Are you looking for specific types of text? Fonts? English-only? Are you familiar with the academic literature?
"Text detection" is a standard problem in any OCR (optical character recognition) system and consequently there are lots of bits of code on the interwebs that deal with it.
I could start listing piles of links from google but I suggest you just do a search for "text detection" and start reading :). There is ample example code available as well.
recognizing text inside an image is indeed a hot topic for researchers in that field, but only begun to grow out of control when captcha's became the "norm" in terms of defense against spam bots. Why use captcha's as protection? well because it is/was very hard to locate (and read) text inside an image!
The reason why I mention captcha's is because the most advancement* is made within that tiny area, and I think that your solution could be best found there.
especially because captcha's are indeed about locating text (or something that resembles text) inside a cluttered image and afterwards trying to read the letters correctly.
so if you can find yourself a good open source captcha breaking tool you probably have all you need to continue your quest...
You could probably even throw away the most dificult code that handles the character recognition itself, because those OCR's are used to read distorted text, something you don't have to do.
*: advancement in terms of visible, usable, and practical information for a "non-researcher"
If you're ok with using an online API for this, the API at http://www.wisetrend.com/wisetrend_ocr_cloud.shtml can do text detection in addition to just OCR.
Stroke width transform can do that for you. That's at least what MS developed for their mobile phone OS. A discussion on the implementation is here at https://stackoverflow.com/

Categories

Resources