From John.Gardus at stonybrookmedicine.edu Fri May 10 15:03:51 2024 From: John.Gardus at stonybrookmedicine.edu (Gardus III, John D) Date: Fri, 10 May 2024 19:03:51 +0000 Subject: [Neuroimaging] Input Parameter for nibabel.load() - Ignore .mat File? Message-ID: Hello, I have a Django-based website used for data management and visualization for my lab. I'm upgrading to Python3 and thus am porting our old NiftiImage calls over to nibabel. I'm running into an issue when trying to load some Analyze images. Due to the way our pipeline is set up, we store a .mat file containing an affine transform matrix for PET-to-MR coregistration along with a mean PET image. When I try to load the PET image with nibabel.load(), I get an error in nibabel/spm99analyze.py. It seems to think the .mat file is associated with the image and fails due to an unexpected filetype when trying to read its data. Is there a way to get nibabel.load() to ignore .mat files in the same directory as an image? Thanks, John This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by e-mail and destroy all copies of the original. -------------- next part -------------- An HTML attachment was scrubbed... URL: From markiewicz at stanford.edu Fri May 10 15:14:28 2024 From: markiewicz at stanford.edu (Christopher Markiewicz) Date: Fri, 10 May 2024 19:14:28 +0000 Subject: [Neuroimaging] Input Parameter for nibabel.load() - Ignore .mat File? In-Reply-To: References: Message-ID: Hi John, If the autodetection in nibabel.load isn't working, you can always pick an image class and load with cls.from_filename. For example: ``` import nibabel as nb import nibabel.analyze img = nb.analyze.AnalyzeImage.from_filename(fname) ``` Best, Chris ________________________________________ From: Neuroimaging on behalf of Gardus III, John D via Neuroimaging Sent: Friday, May 10, 2024 15:03 To: neuroimaging at python.org Cc: Gardus III, John D Subject: [Neuroimaging] Input Parameter for nibabel.load() - Ignore .mat File? Hello, I have a Django-based website used for data management and visualization for my lab. I'm upgrading to Python3 and thus am porting our old NiftiImage calls over to nibabel. I'm running into an issue when trying to load some Analyze images. Due to the way our pipeline is set up, we store a .mat file containing an affine transform matrix for PET-to-MR coregistration along with a mean PET image. When I try to load the PET image with nibabel.load(), I get an error in nibabel/spm99analyze.py. It seems to think the .mat file is associated with the image and fails due to an unexpected filetype when trying to read its data. Is there a way to get nibabel.load() to ignore .mat files in the same directory as an image? Thanks, John This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by e-mail and destroy all copies of the original.