Closed hockeyob closed 3 years ago
haven't tried the code, but according to the code and the spec, the below should read
var data = // an ArrayBuffer
var niftiHeader = null,
niftiImage = null,
niftiExt = null;
if (nifti.isCompressed(data)) {
data = nifti.decompress(data);
}
if (nifti.isNIFTI(data)) {
niftiHeader = nifti.readHeader(data);
console.log(niftiHeader.cal_min, niftiHeader.cal_max)
}
spec relevant code snippit for nifti 1 relevant code snippit for nifti 2
Hi xgui, cal_min and cal_max are both zero for all of my nii files
Were they set in the nii file to begin with? If not, you might have to do a for loop to find min and max.
On Tue, 4 May 2021, 17:23 hockeyob, @.***> wrote:
Hi xgui, cal_min and cal_max are both zero for all of my nii files
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rii-mango/NIFTI-Reader-JS/issues/10#issuecomment-832027700, or unsubscribe https://github.com/notifications/unsubscribe-auth/AET34F7PXARYORXGHTRYDHLTMAGOZANCNFSM44BAODHA .
How do I normalize data in the typedData array? Where can I find the min and max values in the header? Math.min.apply(typedData) returns infinity and any math I try to do in the for loops takes a long time to calculate, slowing the progress. My typed data is a float32array if it matters
Thank you for any help you give! I will provide any additional info if you need