Skip to content
Snippets Groups Projects
Commit 07d1d7ec authored by Mark Jenkinson's avatar Mark Jenkinson
Browse files

Added intensity scaling support to volume and volumeseries

parent ad2a84d8
No related branches found
No related tags found
No related merge requests found
......@@ -212,11 +212,15 @@ namespace MISCMATHS {
short x,y,z,v,type;
float vx,vy,vz,tr;
float slope, intercept;
int doscaling;
FslGetDim(IP,&x,&y,&z,&v);
FslGetVoxDim(IP,&vx,&vy,&vz,&tr);
FslGetOriginator(IP,volinfo.originator);
doscaling = FslGetIntensityScaling(IP,&slope,&intercept);
volinfo.x = x; volinfo.y = y; volinfo.z = z; volinfo.v = v;
volinfo.vx = vx; volinfo.vy = vy; volinfo.vz = vz; volinfo.tr = tr;
......@@ -234,7 +238,8 @@ namespace MISCMATHS {
for(size_t j = 1; j<=(size_t)x*y*z; j++)
{
output(j)=sbuffer[j-1];
if (doscaling==0) { output(j)=sbuffer[j-1]; }
else { output(j)=(slope * sbuffer[j-1]) + intercept; }
}
delete[] sbuffer;
......@@ -247,7 +252,8 @@ namespace MISCMATHS {
for(size_t j = 1; j<=(size_t)x*y*z; j++)
{
output(j)=fbuffer[j-1];
if (doscaling==0) { output(j)=fbuffer[j-1]; }
else { output(j)=(slope * fbuffer[j-1]) + intercept; }
}
delete[] fbuffer;
......@@ -260,7 +266,8 @@ namespace MISCMATHS {
for(size_t j = 1; j<=(size_t)x*y*z; j++)
{
output(j)=cbuffer[j-1];
if (doscaling==0) { output(j)=cbuffer[j-1]; }
else { output(j)=(slope * cbuffer[j-1]) + intercept; }
}
delete[] cbuffer;
......
......@@ -139,10 +139,13 @@ namespace MISCMATHS {
short x,y,z,v,type;
float vx,vy,vz,tr;
float slope, intercept;
int doscaling;
FslGetDim(IP,&x,&y,&z,&v);
FslGetVoxDim(IP,&vx,&vy,&vz,&tr);
FslGetOriginator(IP,volinfo.originator);
doscaling = FslGetIntensityScaling(IP,&slope,&intercept);
volinfo.x = x; volinfo.y = y; volinfo.z = z; volinfo.v = v;
volinfo.vx = vx; volinfo.vy = vy; volinfo.vz = vz; volinfo.tr = tr;
......@@ -168,7 +171,8 @@ namespace MISCMATHS {
volstart = (i-1)*volsize;
for(size_t j = 1; j<=(size_t)x*y*z; j++)
{
output(i,j)=sbuffer[volstart+j-1];
if (doscaling==0) { output(i,j)=sbuffer[volstart+j-1]; }
else { output(i,j)=(slope * sbuffer[volstart+j-1]) + intercept;}
}
}
......@@ -187,7 +191,9 @@ namespace MISCMATHS {
volstart = (i-1)*volsize;
for(size_t j = 1; j<=(size_t)x*y*z; j++)
{
output(i,j)=fbuffer[volstart+j-1];
if (doscaling==0) { output(i,j)=fbuffer[volstart+j-1]; }
else { output(i,j)=(slope * fbuffer[volstart+j-1]) + intercept;}
}
}
delete[] fbuffer;
......@@ -205,7 +211,8 @@ namespace MISCMATHS {
volstart = (i-1)*volsize;
for(size_t j = 1; j<=(size_t)x*y*z; j++)
{
output(i,j)=cbuffer[volstart+j-1];
if (doscaling==0) { output(i,j)=cbuffer[volstart+j-1]; }
else { output(i,j)=(slope * cbuffer[volstart+j-1]) + intercept;}
}
}
delete[] cbuffer;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment