![]() ![]() imdata numpy array member, and any class methods, have straightforward indexing (e.g. I've taken great care to make sure this library can work with images of any dimensionality, and that your image as represented by the. Myblankimage = image(DimSize=,ElementSpacing=,Offset=) If not known extension is found, it assumes you're providing a dicom image or a dicom directory (of images).Īlternatively, you can make a new zeroed out image of 30 by 40 by 50 voxels, spaced out 2mm in each dimension, centered at zero, like so: from medimage import image Images are instatiated with a string representing a file location, where the file extension indicates filetype. UsageĪfter installation, you should be able to open and save an image like so: from medimage import image That is because it is a rather large package, and in developmental flux. Or clone/download this repo and install manually with: $ python3 setup.py install (-user)Ĭurrently, the pymedphys component is NOT installed automatically, which is required when you are going to use the compute_gamma method. You can now use pip! $ pip3 install medimage (-user) A lot of machine learning tooling are heavy users of numpy, and therefore getting your images in is straightforward with this package. It is now a core component to my analyses, and perhaps it can be useful to you too. ![]() The idea is that you can take the medimage directory, drop it into any project, and be able to work with medical images as numpy arrays. This image class grew to suit my needs as part of my phd_tools and later postdoc_tools repos, and in a new job I ported it to Python 3 and added filesupport for AVSFields and Dicom images. Fortunately, the (uncompressed) MetaImage disk format was so straightforward even I could understand it, and it was even suprisingly performant. I wanted to have a thin and pure Python wrapper around numpy that would allows me to read in and write out image data. ITK's Python bindings (SimpleITK) was not pippable or easily usable yet, and I found working with image data as numpy arrays far preferable and faster than using ITK as a library in custom C++ programs which I'd need to compile and recompile as an analysis developed. This project started out at a time when I was analyzing lots of Gate image outputs. SimpleITK write also only seems to produce usable dicoms files when updating an existing image, not when creating a new one from scratch. If it would, it would require SimpleITK, primarily because pydicom does not support dicom image write. This component is governed by its own license.ĭicom write is not supported right now. For NKI decompression I supply a 64bit Linux and Windows lib, if you need support for other platforms you can compile the function in medimage/nki_decomp yourself. Of particular interest perhaps are the DVH analysis function, and the distance to agreement calculation. Included are some basic mathematical operations, some masking functions and crop and resampling functions. Slicing, projections, mathematical operations, masking, stuff like that is very easy with numpy, so you can easily extend things to what you need. imdata member) such that you can easily work with images in these data formats. The image class is a thin wrapper around typed numpy array objects (the. XDR reading includes NKI compressed images (useful to work with your Elekta images). This library supports r/w MetaImage (MHD,ITK), r/w AVSField (.xdr) and read Dicom images. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |