# Colorizing tomography images

Posted 1 month ago
457 Views
|
5 Replies
|
3 Total Likes
|
 Hi there I would like to share a color tomography I was able to obtain using Wolfram, even though the image looks Ok, it is far from what I wanted to make, the image comes out of a long program in which I am not able to change the relation of the numbers that represent the pixels, as I thought I could do on Mathematica. If there is a later advancement on being able to manipulate the pixel values let me know. I would be happy to place the lines of the program, but it is too long, but it does have medical applications for those acquainted with medical images:
5 Replies
Sort By:
Posted 1 month ago
 Could you please add more details about why it is "far from what i wanted to make" and what you are looking for exactly. A minimal example pinpointing the issue is needed. If the notebook is too long you can add it to the post as a file attachment.
Posted 1 month ago
 Hi Sam. Thank you for your interest as soon as I get back to the computer I will do what you told me. Regards.
Posted 1 month ago
 the image comes out of a long program in which I am not able to change the relation of the numbers that represent the pixels ... It is somewhat hard to understand what it is you cannot do here with Mathematica. You just need to define a relation between pixel value and color. An even more simple approach might be this: img = Import["https://cdn.drg.de/media/image/21865/100p/Abb-3-CT-Abdomen-copy-Universitaetsklinikum-Tuebingen.jpg"]; Colorize[img, ImageSize -> ImageDimensions[img], ColorFunction -> #] & /@ ColorData["Gradients"][[;; ;; 3]] Does that help? Regards -- Henrik
 `p12=Image[] p1=Colorize[p12,ColorRules->{j->Yellow,.1*j->LightYellow , .01*j ->Purple ,.001*j-> LightPurple ,k->Blue,.001*K-> LightBlue ,.03*K-> Black ,ComplexInfinity->White}] p2=ImageData[%] Image[v] HistogramTransform==v u=ImageDimensions[p1] t=Reverse[u] o1=ImageLevels[p1] p=Flatten [p2] ImageHistogram[p1] ImageHistogram [p12] n=p*(p-Power[p, (p)^-1]) l=p-p*Power[p, (p)^-1] k=n/l j=(n/l)^p bg=Binarize[o1, f] Module f= PixelValue=j->Yellow=j->Yellow=j->Blue=k->Blue->{p1,j} ReplacePixelValue[p1,{j,p1}] f=Module{u}->Yellow==20>j>1->j->{j;p1}==Yellow=Yellow=j Column[ColorConvert[j,v]&/@{"Green"}] ImageApply[UnitStep[f]&,bg] SetAlphaChannel[f,p1] ImageHistogram [p1] ImageTransformation[p1,{f}&,DataRange->{{All}}] ImageHistogram [v] Do [NestWhile .1 * 10^-7{j->Yellow,k->Blue}] c3=HistogramTransform[c] c2=ImageSubtract[d,c] g=Image[p1] ColorSeparate[g,"Red"] z=ImageSubtract[ImageSubtract[#1]& @@ ColorSeparate[g,"Blue"]] v1=ImageSubtract[g,z] ImageSubtract[p1,v1] b=ImageFilter[MedianDeviation[Flatten[#]]&,c2,2]// ImageAdjust z1=ImageSubtract[ImageSubtract[#1]& @@ ColorSeparate[c2,"Blue"]] b1=Colorize[z1,ColorRules->{z1->Pink,ComplexInfinity->White}] ImageMultiply[c2,c3] img=HistogramTransform[%] DominantColors[%] ImageMultiply[v,c,d,c2,g,z,c3] HistogramTransform[%] p21=ImageData[img] p13=Image[v5] DominantColors[%] HistogramTransform==v5 u1=ImageDimensions[p21] t1=Reverse[u1] o12=ImageLevels[p21] pr=Flatten [p21] ImageHistogram[p13] ImageHistogram [img] n1=pr*(pr-Power[pr, (pr)^-1]) l1=pr-pr*Power[pr, (pr)^-1] k1=n1/l1 j1=(n1/l1)^pr bg1=Binarize[o12, f1] Module f1= PixelValue=j1->Yellow=j1->Yellow=j1->Blue=k1->Blue->{img,j1} ReplacePixelValue[img,{j1,img}] f1=Module{u1}->Yellow==20>j1>1->j1->{j1;img}==Yellow=Yellow=j1 Column[ColorConvert[j1,v5]&/@{"Green"}] ImageApply[UnitStep[f1]&,bg1] SetAlphaChannel[f1,img] ImageHistogram [img] ImageTransformation[img,{f1}&,DataRange->{{All}}] ImageHistogram [v5] Do [NestWhile .1 * 10^-7Yellow=j4->Yellow=j4->Blue=k4->Blue->{p14,j4} ReplacePixelValue[p14,{j4,p14}] f4=Module{u4}->Yellow==20>j4>1->j4->{j4;p14}==Yellow=Yellow=j4 Column[ColorConvert[j4,v]&/@{"Green"}] ImageApply[UnitStep[f4]&,bg4] SetAlphaChannel[f4,p14] ImageHistogram [p14] ImageTransformation[p14,{f4}&,DataRange->{{All}}] ImageHistogram [v4] Do [NestWhile .1 * 10^-7{j4->Yellow,k4->Blue}] c34=HistogramTransform[c4] c24=ImageSubtract[d4,c4] g4=Image[p14] ColorSeparate[g4,"Red"] z4=ImageSubtract[ImageSubtract[#1]& @@ ColorSeparate[g4,"Blue"]] v14=ImageSubtract[g4,z4] ImageSubtract[p14,v14] b4=ImageFilter[MedianDeviation[Flatten[#]]&,c24,2]// ImageAdjust z14=ImageSubtract[ImageSubtract[#1]& @@ ColorSeparate[c24,"Blue"]] b14=Colorize[z14,ColorRules->{z14->Pink,ComplexInfinity->White}] ImageMultiply[c24,c34] img4=HistogramTransform[%] DominantColors[%] ImageMultiply[v4,c4,d4,c24,g4,z4,c34] HistogramTransform[%] p214=ImageData[img4] p134=Image[v54] DominantColors[%] HistogramTransform==v54 u14=ImageDimensions[p21] t14=Reverse[u14] o124=ImageLevels[p214] pr4=Flatten [p214] ImageHistogram[p134] ImageHistogram [img4] n14=pr4*(pr4-Power[pr4, (pr4)^-1]) l14=pr4-pr4*Power[pr4, (pr4)^-1] k14=n14/l14 j14=(n14/l14)^pr4 bg14=Binarize[o124, f14] Module f14= PixelValue=j14->Yellow=j14->Yellow=j14->Blue=k14->Blue->{img4,j14} ReplacePixelValue[img,{j14,img4}] f14=Module{u14}->Yellow==20>j14>1->j1->{j14;img4}==Yellow=Yellow=j14 Column[ColorConvert[j14,v5]&/@{"Green"}] ImageApply[UnitStep[f14]&,bg14] SetAlphaChannel[f14,img4] ImageHistogram [img4] ImageTransformation[img4,{f14}&,DataRange->{{All}}] ImageHistogram [v5] Do [NestWhile .1 * 10^-7