pnlbwh / CNN-Diffusion-MRIBrain-Segmentation

CNN based brain masking
Other
14 stars 10 forks source link

Question about check_gradient() #5

Closed tashrifbillah closed 4 years ago

tashrifbillah commented 4 years ago

Are you checking if the # of gradients in sizes field equals the number of gradient directions in the header?

bashCommand1 = ("unu head " + input_file + " | grep -i sizes | awk '{print $5}'")
bashCommand2 = ("unu head " + input_file + " | grep -i _gradient_ | wc -l")
output1 = subprocess.check_output(bashCommand1, shell=True)
output2 = subprocess.check_output(bashCommand2, shell=True)

if output1.strip():
     header_gradient = int(output1.decode(sys.stdout.encoding))
     total_gradient = int(output2.decode(sys.stdout.encoding))

https://github.com/pnlbwh/CNN-Diffusion-MRIBrain-Segmentation/blob/70a4832a2ebc6e34d341703819016f362bde7659/pipeline/preprocessing.py#L67

Should you not be checking if the # of gradients in the image equals the # of gradients in the size field instead?

tashrifbillah commented 4 years ago

The function has become obsolete by this commit https://github.com/pnlbwh/CNN-Diffusion-MRIBrain-Segmentation/commit/c18b5f5bc51b955a07e55b52e35f9b5ea0528a0f

conversion/nifti_write.py should roughly replicate the purpose of check_gradient().

senthilcaesar commented 4 years ago

Yes, I am checking only that total_gradient is the # of the gradients in the image header_gradient is the # of the gradients given in the size field