How to calculate random shift intensity difference (RSID) feature?
Mostrar comentarios más antiguos
Hi,
I have 3D patients volumes saved in a matlab variable.
I need to extract random shift intensity difference (RSID) feature, this feature compares the intensity of the current voxel x and another
voxel x + u with random offset u, ` f(x, u) = I(x + u) − I(x)`, where u is a random offset vector.
My question is
- How many neighbors of a specific voxel needs to be considered to calculate RSID?
- How to find them with matlab code?
Your help is appreciated
Respuestas (1)
Image Analyst
el 9 de Dic. de 2018
I think you'd have to scan your 3-D value one voxel at a time.
If you just want the intensity difference over all the neighbors, you can simply use convn with a kernel of all -1 excel the center being 26
kernel = -1 * ones(3,3,3);
kernel(2,2,2) = 26;
kernel = kernel / 26; % So output is in same intensity range as input.
output = convn(inputImage, kernel, 'same');
Why do you want the difference at just one randomly located pixel instead of the average over ALL neighbors?
6 comentarios
Sara Salimi
el 9 de Dic. de 2018
Image Analyst
el 9 de Dic. de 2018
I guess you don't want to answer my question, but want me to answer yours.
You can get u from randi():
u = rand(uMax, 1, 1);
After that, it's just a dumb, brute force triple nested for loop that I'm sure you can do. Get a u for each direction: row, column, and slice. So you'll have 3 u's. And make sure you get the indexing right: arrays are not indexed array(x,y,z), they're indexed array(y,x,z).
Sara Salimi
el 9 de Dic. de 2018
Editada: Sara Salimi
el 9 de Dic. de 2018
Image Analyst
el 9 de Dic. de 2018
Editada: Image Analyst
el 9 de Dic. de 2018
So let's see your for loop. Did it look something like this:
for slice = 1 : slices
for col = 1 : columns
for row = 1 : rows
ur = 2*randi([0, 1], 1, 1) - 1;
uc = 2*randi([0, 1], 1, 1) - 1;
us = 2*randi([0, 1], 1, 1) - 1;
randomPixel = double(image3d(row+ur, col+uc, slice+us));
thisPixel = double(image3d(row, col, slice))
diffmage(row, col, slice) = thisPixel - randomPixel;
end
end
end
If not, what did it look like?
Sara Salimi
el 11 de Dic. de 2018
Editada: Sara Salimi
el 11 de Dic. de 2018
Sara Salimi
el 30 de Dic. de 2018
Categorías
Más información sobre Descriptive Statistics en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!