views:

1465

answers:

8

I am looking to build a medical solution to be used by surgeons to visualize Dicom images in 3D. Also, the software will allow them to perform some segmentation and manipulation to the images.

I will probably use the VTK package www.vtk.org/ to assist with this project.

Now, I am wondering whether it is easier and better to do this project in C#, C++ or Python? I appreciate any help in finding how to choose between these three options.

+2  A: 

If you can get away with python — in other words, if you know it will run fine in python, I would definitely chose it over C#/C++.

I'm sure whatever 3D library you use is built in C or C++ anyway, so interfacing with it with a high level language like python shouldn't cause a slowdown.

cloudhead
I was wondering why would you recommend Phython over C# and C++
Bekh
Python is a higher level language, and thus you will get more work done, quicker, and with less pain. It can be argued that C# is a high level language too, but C++ is not, and you'll run in much more trouble if you decide to use that.
cloudhead
C++ is as high level as the programmer codes it
Todd Gardner
@Todd Gardner: That's like saying C is as high level as the programmer codes it. There's nothing inherently wrong about being the lowest-level language in a roundup. C++ does have some advantages, but it is clearly lower-level than Python, and somewhat lower-level than C#.
John Y
@John: Why? Because it hast more syntactic sugar? Because it has reflection built-in? Garbage Collection? I really don't know how you measure your 'higher-level'.
Christopher
A: 

I worked for Sound Vet for a while. They provide xray imaging software for the veterinary field. They use C# and winforms.

Andrew Siemer
+3  A: 

Personally, I'm a c++ and python guy, and I would probably go with c++, because this sounds like a relatively intensive project, and I do most of my best high level design in C++ (great for building fast, flexible code base), while I tend to use python for things like django, where there is less application logic, but being able to tune the function, look and feel quickly is very important. However, my choice doesn't mean it should be your choice. Here's a few things to consider:

Foremost 1) Familiarity. If you are coding production code, you want to go with something you know, and works well for you, or you'll be struggling with the language and be missing deadlines. And even when you complete the project, you are bound to have a lot of messy code for things you were learning. I'm all for learning new languages, but make it on something you can afford to screw up on.

2) Third party libraries; which ones do you want besides the one you mentioned? If they don't have wrappers, you'll be rolling your own. What you want to write your GUI in would be an example.

3) Deployment: I assume this will be an assumed windows executable. C# and C++ both do this easily, but you'll have to be familiar with py2exe if you are planning on deploying a python program without a python interpreter

Todd Gardner
A: 

I agree with Todd Gardner that familiarity is probably the biggest factor determining the success of a programming language choice. So if you are much more familiar with one of those three languages than the other two (or whatever your other options are), I would recommend picking that one.

However, if you are equally unfamiliar with all of them, then I would second cloudhead's recommendation of Python. I believe it is the easiest of the three to learn and become productive in.

John Y
+1  A: 

Most medical 3D-images are usually very big (GB-size). You want to choose a language which can easily cope with these. To my knowledge C# has a 2GB memory limit (I'm not 100% sure) which may cause some problems.

I don't have any experience with Python so I'm not going to go further down that path. But I've worked with both C# and C++ on medical image data (reconstruction, filtering, normalizing and other heavy calculations). In our case C++ is the only choice because of speed. But when it comes to viewing the images, this may probably not an issue.

I wish you the best of luck. A good stable and quick 3D-viewer would be great!

AnnaR
C#/.NET does and doesn't have a 2GB memory limit. If you are trying to allocate a single continous chunk of memory (i.e. new byte[x]), then you are limited to 2GB. This is deliberate. However on a 64bit system you can allocate as much memory as the system normally allows, so long as no one chuck exceeds the 2GB that would be possible when the assembly is run on a 32bit system. To load a large image, you might create one byte[] array for each scanline, instead of trying to create one massive array for the entire image. You could also using a generic abstraction class to make the array in blocks
David
+4  A: 

Python is getting popular for 3d visualization - several labs use it for brain imagery, for example. So it is definitely usable for that kind of problems. Library-wise, I guess you are aware than things like vtk and co can be used from python.

http://neuroimaging.scipy.org/site/doc/manual/html/faq/why.html

Of course, doing it in C++, in theory, will result in faster programs, everything else being equal (same algorithms, programmers proficient in the language, etc...) and given 'infinite time'. But python is certainly more productive than C++: in a given amount of time, you will get more things done in python than in C++, unless you are a much better programmer in C++ than in python. Also, if there is a need to interact with scientific people who are not programmers, python will be more readable than C++. C++ produced by researchers/scientific people tend to be really horrible in my experience (even worse than Fortran :) ).

The biggest problem I can foresee is if python is not fast/memory efficient enough, so that it involves a lot of constraints from an architectural point of view. I don't think it will be the case for imagery (python, as most high level languages, has scalability problems when you need ten of thousand of objects with a lot of interactions - that's one of the few areas where using C++ for a project started from scratch still makes sense IMHO nowadays).

Disclaimer: I should mention that I am involved quite a lot in the scientific python community, and that I am not an image processing specialist.

David Cournapeau
+1 We use both C++ and Python for numeric tasks. The only times we ran into issues with Python was when we had a ton of small objects. Python then tended to use too much memory. And if it is too slow, you cannot simply speed it up by calling a library because the I/O for small objects is too slow and you still have memory issues. But if you have one big object and you can call a library for some of the heavy work, Python has much faster round-trip times and I would go for it.
stephan
A: 

Most professional medical imaging companies use the Accusoft Pegasus PICTools libraries. They provide the fastest, and most standard compression and decompression for all DICOM lossy and lossless formats such as JPEG 2000, Lossless JPEG, JPEG-LS, and others.

IF speed is required, nothing will compare.

If you're deploying on Windows, ImageGear .NET or ImageGear Pro will give you easy-to-use environments with full support for DICOM dcm files.

You can also use ImagXpress for Windows development.

A: 

ITK is the bee's knees of medical image processing, and that's in C++. so i guess i'd recommend C++ w/ ITK.

Autoplectic