Hi,
On Mon, Apr 2, 2012 at 11:06 PM, Matthew Brett <[log in to unmask]> wrote:
> Hi,
>
> On Mon, Apr 2, 2012 at 12:47 AM, Pieter Vandemaele
> <[log in to unmask]> wrote:
>> Hi Matthew,
>>
>> Sorry for the delay.
>> I think that the scalefactor should be the same for comparison.
>> And I really don't mind to post the scriptlet to the list. It is certainly useful for a lot of people.
>> Thanks a lot for you effort.
>
> I've attached a couple of scripts that might do what you want.
>
> You need the nibabel package installed:
>
> http://nipy.sourceforge.net/nibabel/installation.html
>
> If you are on Python 2.6 or 2.7 you also need 'argparse':
>
> http://pypi.python.org/pypi/argparse
>
> From thence (with the attached scripts on your path):
>
> raw_nii2ana.py input_nifti.nii output_analyze.img
>
> (process...)
>
> raw_ana2nii.py processed_analyze.img --scaling-from=input_nifti.nii
> --output=processed_scaled.nii
>
> Please do test and let me know if there are any problems with
> installation or the output,
I should also say that these scripts do what I thought you were asking for:
raw_nii2ana
1) Read data from nifti image without slope or intercept applied
2) Write unscaled data to analyze image
raw_ana2nii
1) Read (unscaled) data from analyze image
2) Apply slope and intercept from some original nifti image
3) Write this rescaled data
I wonder though whether you actually want this:
1) Read scaled data from nifti image
2) Write floating point analyze image using scaled data
then
1) Read floating point analyze image
2) Write floating point nifti image
That's also easy, let me know if that's actually what you want,
Best,
Matthew
|