In[]:=
Clear["Global`*"](*clearallMathematicavariables*)
In[]:=
SetDirectory[NotebookDirectory[]](*setworkingdirectory*)
Out[]=
/Applications/MCNP6_OSX/mcnpdir1/Cherenkov sims/JBScan model/Scan scenarios/Scenario 08
Import raw image in 32 bit TIFF format...
Import raw image in 32 bit TIFF format...
In[]:=
rawimg=Import["cross-raw.tif"];(*importrawimagefile*)
In[]:=
{minpix,maxpix}=MinMax[ImageData[rawimg]];(*findmin/maxpixelvalues*)
In[]:=
Style[ImageAdjust[rawimg,{0,0,1},{minpix,maxpix}],(*showrawimage@4X*)Magnification4]
Out[]=
In[]:=
MinMax[ImageData[rawimg]](*shouldbe(1.,10.}*)
Out[]=
{1.,10.}
Rotate image CW by 5˚ via sequential shear operators...
Rotate image CW by 5˚ via sequential shear operators...
In[]:=
α=-Tan[-2.500Degree];(*shearparameters*)
In[]:=
β=+Sin[-5.000Degree];
In[]:=
shrop1={{1,α},{0,1}}(*1stshearoperator(||toXaxis)*)
Out[]=
{{1,0.0436609},{0,1}}
In[]:=
shrop2={{1,0},{β,1}}(*2ndshearoperator(||toYaxis)*)
Out[]=
{{1,0},{-0.0871557,1}}
In[]:=
shrop3={{1,α},{0,1}}(*3rdshearoperator(||toXaxis)*)
Out[]=
{{1,0.0436609},{0,1}}
In[]:=
crschk=shrop3*shrop2*shrop1(*product?=?identitymatrix*)
Out[]=
{{1,0.},{0.,1}}
Apply shear operators to rawimg in sequential order...
In[]:=
shear1=Image[Graphics[GeometricTransformation[rawimg,shrop1]]];
Question 1: Is this the right way to do an image shear? Apparently not (see below).
In[]:=
Style[ImageAdjust[shear1,{0,0,1},{minpix,maxpix}]](*showshear1image*)
Out[]=
Question 2: Is this the right way to plot the sheared image (i.e. if it had been done correctly)?
Out[]=
Question 3: Why is the image shown not sheared, and what happened to the cross?
In[]:=
MinMax[ImageData[shear1]]
Out[]=
{1.,1.}
Question 4: The min and max of the raw image are 1 and 10 respectively. What happened?
In[]:=
shear21=Image[Graphics[GeometricTransformation[shear1,shrop2]]];
( Same questions and comments as with shear1 above. )
In[]:=
Style[ImageAdjust[shear21,{0,0,1},{minpix,maxpix}]](*showshear21image*)
Out[]=
In[]:=
MinMax[ImageData[shear21]]
Out[]=
{1.,1.}
In[]:=
shear321=Image[Graphics[GeometricTransformation[shear21,shrop3]]];
( Same questions and comments as with shear1 above. )
In[]:=
Style[ImageAdjust[shear321,{0,0,1},{minpix,maxpix}]](*showshear321image*)
Out[]=
In[]:=
MinMax[ImageData[shear321]]
Out[]=
{1.,1.}
In[]:=
In[]:=
rotimg=shear321;(*rename(justforconvience)*)
Export rotated image in 32 bit TIFF format...
Export rotated image in 32 bit TIFF format...
Question 5: The output file is not in a valid TIFF format (e.g. can’t be read by ImageJ). Why not?