Skip to main content
Formatted code
Source Link
MarcoB
  • 67.7k
  • 18
  • 96
  • 198

I have 2D image data set for 3D image. Since my data is very large, in this question, I use sample data.

testdata = Import["ExampleData/CTengine.tiff", "Image3D"];
sl = Image3DSlices[testdata];

(The the structure of my own data is same as "sl".)

Now, I want to color certain pixels (in the different color from the "sl" depicting color) of 

Now, I want to color certain pixels (in the different color from the "sl" depicting color) of 30th picture in the 2D positions of

{{25, 30}, {27, 32}, {26, 31}}

100th picture in 2D positions of

{ {{63;;6563 ;; 65}, {42;;4542 ;; 45}} , {150, 70}, {{200;;205200 ;; 205}, {230, 234}} }

250th picture in 2D positions of

{{12, 90}, {100, 180}, {3, 48}, {230, 250}}

So I made another 3D data set for depicting spots as

SpotdataForEachz = Table[Table[0, 256], 256];
stack = Table[SpotdataForEachz, 256];   

stack[[30]][[25]][[30]] = 1;
stack[[30]][[27]][[32]] = 1;
stack[[30]][[26]][[31]] = 1;

stack[[30]][[63 ;; 65]][[42 ;; 45]] = 1;
stack[[30]][[150]][[70]] = 1;
stack[[30]][[200 ;; 205]][[230 ;; 234]] = 1;

 

stack[[100]][[12]][[90]] = 1;
stack[[100]][[100]][[180]] = 1;
stack[[100]][[3]][[48]] = 1;
stack[[100]][[230]][[250]] = 1;

 

stack[[250]][[12]][[90]] = 1;
stack[[250]][[100]][[180]] = 1;
stack[[250]][[3]][[48]] = 1;
stack[[250]][[230]][[250]] = 1;

ima = Image[#] & /@ stack;

Then I tried to overlay

Overlay[{Image3D[sl], Image3D[im]}]

However it didn't work. Also, I think there might be a better way of doing this... Does Does anyone have nice idea for this problem?

I have 2D image data set for 3D image. Since my data is very large, in this question, I use sample data.

testdata = Import["ExampleData/CTengine.tiff", "Image3D"];
sl = Image3DSlices[testdata];

(The the structure of my own data is same as "sl".)

Now, I want to color certain pixels (in the different color from the "sl" depicting color) of 

30th picture in the 2D positions of

{{25, 30}, {27, 32}, {26, 31}}

100th picture in 2D positions of

{ {{63;;65},{42;;45}} , {150,70}, {{200;;205},{230,234}} }

250th picture in 2D positions of

{{12,90},{100,180},{3,48},{230,250}}

So I made another 3D data for depicting spots as

SpotdataForEachz = Table[Table[0, 256], 256];
stack = Table[SpotdataForEachz, 256];   

stack[[30]][[25]][[30]] = 1;
stack[[30]][[27]][[32]] = 1;
stack[[30]][[26]][[31]] = 1;

stack[[30]][[63 ;; 65]][[42 ;; 45]] = 1;
stack[[30]][[150]][[70]] = 1;
stack[[30]][[200 ;; 205]][[230 ;; 234]] = 1;

 

stack[[100]][[12]][[90]] = 1;
stack[[100]][[100]][[180]] = 1;
stack[[100]][[3]][[48]] = 1;
stack[[100]][[230]][[250]] = 1;

 

stack[[250]][[12]][[90]] = 1;
stack[[250]][[100]][[180]] = 1;
stack[[250]][[3]][[48]] = 1;
stack[[250]][[230]][[250]] = 1;

ima = Image[#] & /@ stack;

Then I tried to overlay

Overlay[{Image3D[sl], Image3D[im]}]

However it didn't work. Also, I think there might be a better way of doing this... Does anyone have nice idea for this problem?

I have 2D image data set for 3D image. Since my data is very large, in this question, I use sample data.

testdata = Import["ExampleData/CTengine.tiff", "Image3D"];
sl = Image3DSlices[testdata];

(The the structure of my own data is same as "sl".)

Now, I want to color certain pixels (in the different color from the "sl" depicting color) of 30th picture in the 2D positions of

{{25, 30}, {27, 32}, {26, 31}}

100th picture in 2D positions of

{ {{63 ;; 65}, {42 ;; 45}}, {150, 70}, {{200 ;; 205}, {230, 234}} }

250th picture in 2D positions of

{{12, 90}, {100, 180}, {3, 48}, {230, 250}}

So I made another 3D data set for depicting spots as

SpotdataForEachz = Table[Table[0, 256], 256];
stack = Table[SpotdataForEachz, 256];   

stack[[30]][[25]][[30]] = 1;
stack[[30]][[27]][[32]] = 1;
stack[[30]][[26]][[31]] = 1;

stack[[30]][[63 ;; 65]][[42 ;; 45]] = 1;
stack[[30]][[150]][[70]] = 1;
stack[[30]][[200 ;; 205]][[230 ;; 234]] = 1;

stack[[100]][[12]][[90]] = 1;
stack[[100]][[100]][[180]] = 1;
stack[[100]][[3]][[48]] = 1;
stack[[100]][[230]][[250]] = 1;

stack[[250]][[12]][[90]] = 1;
stack[[250]][[100]][[180]] = 1;
stack[[250]][[3]][[48]] = 1;
stack[[250]][[230]][[250]] = 1;

ima = Image[#] & /@ stack;

Then I tried to overlay

Overlay[{Image3D[sl], Image3D[im]}]

However it didn't work. Also, I think there might be a better way of doing this. Does anyone have nice idea for this problem?

Source Link
rani
  • 491
  • 3
  • 8

Add points to 3D image

I have 2D image data set for 3D image. Since my data is very large, in this question, I use sample data.

testdata = Import["ExampleData/CTengine.tiff", "Image3D"];
sl = Image3DSlices[testdata];

(The the structure of my own data is same as "sl".)

Now, I want to color certain pixels (in the different color from the "sl" depicting color) of 

30th picture in the 2D positions of

{{25, 30}, {27, 32}, {26, 31}}

100th picture in 2D positions of

{ {{63;;65},{42;;45}} , {150,70}, {{200;;205},{230,234}} }

250th picture in 2D positions of

{{12,90},{100,180},{3,48},{230,250}}

So I made another 3D data for depicting spots as

SpotdataForEachz = Table[Table[0, 256], 256];
stack = Table[SpotdataForEachz, 256];   

stack[[30]][[25]][[30]] = 1;
stack[[30]][[27]][[32]] = 1;
stack[[30]][[26]][[31]] = 1;

stack[[30]][[63 ;; 65]][[42 ;; 45]] = 1;
stack[[30]][[150]][[70]] = 1;
stack[[30]][[200 ;; 205]][[230 ;; 234]] = 1;



stack[[100]][[12]][[90]] = 1;
stack[[100]][[100]][[180]] = 1;
stack[[100]][[3]][[48]] = 1;
stack[[100]][[230]][[250]] = 1;



stack[[250]][[12]][[90]] = 1;
stack[[250]][[100]][[180]] = 1;
stack[[250]][[3]][[48]] = 1;
stack[[250]][[230]][[250]] = 1;

ima = Image[#] & /@ stack;

Then I tried to overlay

Overlay[{Image3D[sl], Image3D[im]}]

However it didn't work. Also, I think there might be a better way of doing this... Does anyone have nice idea for this problem?