Feature Extraction from 3D .nii MRI Images

3d
edge
imagej
spatial-analysis
features

#1

Hello,

I have a series of images in .nii format. Basically these are 3D images that represent the MRI of a brain, in 256 frames.

My questions are:

  1. How do I do feature extraction in such a way that I can have ImageJ output a set of features in maybe a text file that can then be used for machine learning by other programs?

  2. How do I make ImageJ understand these 256 frames all represent a single image? When I try to use some of the analysis options it seems to only do it for a single frame, I need it to do analysis/feature extraction for the entire 3D image as a single unit. Does this have something to do with Stacks? Because it doesn’t let me turn a singular .nii file into a Stack.

  3. Is there a way to do any kind of shape matching or other classification techniques for images within ImageJ itself?


#2

Hi @Brent_Lippert,

Welcome to the forum!

  1. What exactly do you want to do with the features? What kinds features do you want? It’s hard to give you specific advice without details, but Trainable Weka Segmentation can compute 3D features and will export them for you (as tifs), for example.

  2. ImageJ uses Bioformats to read Nifti files. I’ve had success in using it to open 3D nii files - are your images being imported as 2D?
    Whether the image is treated as 2D or 3D depends more on the plugin/algorithm than on ImageJ. If your image has been opened as a 3D stack, then an appropriate plugin can and will treat it as a single 3D image.

  3. There isn’t shape matching that I know of, but check this out and see if any might be useful to you. Also, if you’re willing to share more details regarding what you want to accomplish, I’m sure the folks here would be happy to give more specific advice.

Cheers,
John


#3

Hi @Brent_Lippert,

It looks you are referung to 3D segmentation and 3D shape analysis. First you need to import all 256 slices using Import/image sequence if possible, else you need to open one by one (using a macro for instance) and then stack all the slices together into one stack using the images to stack command. Then you may want to segment your structure in 3D, look at 3D Object Counter or 3D ImageJ Suite. Then you need to analyse the shape of your structure, see the plugins above.
Hope this helps
Best,


#4

@ThomasBoudier Great thanks that helps!

But so there isn’t a way for me to make a stack from images represented by the slider that changes frame by frame? Cause it already loads them as having a t dimension, but I have to actually open every single frame separately in order for it to be z instead? Cause that will be very time consuming.


#5

@bogovicj Thanks, that helps! And so:

  1. We’ll be exploring basically any type of feature you can extract since machine learning techniques will use feature selection to filter which ones are actually useful.

  2. Ya it seems that they’re being imported as a series of 2D images instead of one 3D. I mean it provides a slider that lets me traverse the z dimension but it doesn’t seem to actually consider them all as one image instead as 256 images with a t dimension. So how would I open it as a 3d stack?

  3. Ok so here’s a full project description:
    I have about ~60 MRI images, some of patients with schizophrenia and some control. So I want to explore algorithmic techniques for classifying the images as schizophrenic or not. Part of this will be done with deep learning on the raw images, but I also want to explore feature extraction before using other machine learning techniques. But the general idea is, because schizophrenia is a degenerative disease resulting in less grey (gray? i always forget ha) matter, particularly in the center of the frontal lobe, it should be possible using various computer vision techniques to diagnose advanced schizophrenia with MRI images.


#6

@bogovicj @ThomasBoudier

Though I’ll be honest I could just be doing something wrong/misinterpreting how ImageJ is working with he whole 2D vs 3D thing, I’m completely new to ImageJ so it’s possible that it is loading my MRIs as a 3D stack and I’m just dumb and not using the analyze functions and what-not right. I’ll be spending a lot of time familiarizing myself with the program more so we’ll see if I can get it figured out.


#7

This suggests that ImageJ is doing something reasonable.

What makes you think this (?) ie did you try something that gave unexpected results?

Try this: After you open an MRI, Plugins > BigDataViewer > Open Current Image, then click and drag your mouse around to change the slicing plane. I hope this will convince you that your data are being treated as a 3d volume (at least by the bigdataviewer plugin).

Not dumb, just new. Keep us posted if you run into something unexpected with particular plugins / algorithms. There are certainly some plugins that work on 2d images only and so won’t give you the result you want.


#8

Ya the issue was I was using a plugin for 2D not 3D, I got it all worked out thanks!


#9

Hi guys. I am writing a macro that reads a bunch of .nii images for further pre processing. However, for each image my macro gets stuck at bio-formats screen and I have to manually hit OK. Is there any way to skip this? Thanks,

PS: I am using “open(image_path)” to open the images.


#10

Hi guys. Just found the solution: Bio-Formats Windowless Importer (https://docs.openmicroscopy.org/bio-formats/5.3.4/users/imagej/load-images.html). Thanks,


#11

Hi,
I actually converted a 3D image (NIFTI) format into 2D format which I got 155 slices. I dont know onwhich slice feature extraction can be performed. Or is there direct code whcih can extract slices directly from 3D image


#13

Hi,
I am also processing MRI image(.nii). My question is that how did you get slices from a 3D image.


#14

Hello,
Wether you find solutions about this problem? Can you share it with us? My email is hyy.who@gmail.com
Thanks!