Coder Social home page Coder Social logo

bru2nii's Introduction

Introduction

**This software is no longer actively maintained. Please use Bruker's own ParaVision 360. You may also want to try BrkRaw which is actively maintained (though like all tools only tested an a small proportion of the Bruker files that have changed in undocumented ways over thee years).git **

This is a simple tool for converting Bruker ParaVision MRI data to the NIfTI file format. While every attempt has been made to provide robust support, the ParaVision format is inherently complicated, contradictory, poorly documented, and has included explicit errors. One is left wondering if this format is intentionally obfuscated. New versions have defined features and added new features that appear to conflict with existing older features. Therefore, it is often unclear what the correct solution is, and different tools (see links below) may provide different solutions. Users should use any Bruker conversion tools with extreme caution and encourage the vendor to directly support simpler formats (e.g. creating a NIfTI "hdr" header file when the Paravision files are generated could be done seamlessly and would greatly aid customers). As a professional company, Bruker has an obligation and incentive to help users access their data. Variations of this project have existed since 1999, and yet the situation has not improved. Any customer considering purchasing equipment or services from this company should demand they develop a cleaner, more transparent solution that will reduce costs in terms of support and potentially erroneous results.

This project includes both a drag-and-drop graphical interface (Bru2Nii) as well as a command line tool (Bru2). The compiled tools run on Windows, Linux and OSX without requiring any other files to be installed. The source code can be built using Lazarus without any other tools required. This project is inspired by the Perl script pvconv.

You can find pre-compiled binary executables with the latest release. Alternatively, one can recompile the latest version.

Usage (Command Line)

Provide the name of the Bruker format 'acqp' or 'subject' file you wish to convert. Here are a few examples for Windows

  • Convert all data from a subject Bru2 c:\mydata\subject
  • Convert single session Bru2 c:\mydata\10\acqp
  • Convert, appending protocol name to output filename Bru2 -p c:\mydata\10\acqp
  • Convert to specific folder Bru2 -o c:\output c:\mydata\10\acqp Here are examples for Unix
  • Convert all data from a subject Bru2 /Users/cr/dir/subject
  • Convert single session Bru2 /Users/cr/dir/acqp
  • Convert, appending protocol name to output filename Bru2 -p /Users/cr/dir/acqp
  • Convert to specific folder Bru2 -o /Users/cr/dir2/out /Users/cr/dir/acqp
Usage (Graphical Interface)

Drag and drop the Bruker 'acqp' or 'subject' file you wish to convert.

alt tag

Installation

The easiest way to use this software is to download an executable compiled for your operating system. Versions are provided for Windows, MacOS and Linux. There are two programs: a command line version and a graphical interface.

Compile from Source
  1. You will want to install Lazarus. For Windows, download and run the unified installer. For Linux and OSX, you will want to install the lazarus, fpc and fpc-src packages.
  2. You can build these tools from the graphical interface. For example, launch Lazarus. Select Project/OpenProject and then choose project you wish to compile (for example Bru2Nii.lpr). Finally, choose the Run/Run command.
  3. To compile the console version from the command line, run either one of these commands "fpc Bru2.lpr" or "lazbuild -B Bru2.lpr".
  4. To build the graphical version from the command line, run the command "lazbuild -B Bru2Nii.lpr". Note by default OSX will compile to 32-bit Carbon. If you have a recent SVN of Lazarus (50307 or later) you can compile as 64-bit Cocoa with "lazbuild ./Bru2Nii.lpr --cpu=x86_64 --ws=cocoa --compiler="/usr/local/bin/ppcx64""
  5. You may optionally strip you executables to make them require less disk space, e.g. "strip ./Bru2Nii", "strip ./Bru2" - the compiler will probably do this automatically for Windows or Linux, but not OSX (due to the debugger).
Versions

3March2018 : v 1.0.20180303

License

Being inspired by a Perl script we maintain the same license (http://dev.perl.org/licenses/) as the original pvconv project.

Links

bru2nii's People

Contributors

naveau avatar neurolabusc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bru2nii's Issues

Superior and inferior label switched in converted NIFTI

Superior and inferior label switched in converted NIFTI. What could be the cause?
--> Maybe a checkbox for separately switching LR, PA, IS labels would be useful.

-Also a checkbox for 'floating point numbers' would be great.

Bru2 requires write permissions on 2dseq file

I kept getting the following error message

wguest@clusterhost ~ $ Bru2 -v -a -o ~/13 /mnt/data/ni_data/rsfM/20170623_184053_62
56_1_1/13                                                                          
                                                                                   
Creating NIfTI: /home/wguest/1_13.nii                                              
Bruker Source: /mnt/data/ni_data/rsfM/20170623_184053_6256_1_1/13/pdata/1/reco     
ACQ_protocol_name : 3_ssEPI_CBV                                                    
 Endian: Little                                                                    
 Bits : 16                                                                         
 Size : 60x40                                                                      
 FOV : 1.35x0.89999998                                                             
 Matrix : [0.99994642 0.010180509 0.0018661461; -0.010277266 0.99799132 0.062511407
; -0.0012259998 -0.062527232 0.99804252]                                           
 Sepn (Thick+Gap) : 0.44999999                                                     
 Slice Thick : 0.44999999                                                          
 Offset (Read/Phase/Slice) : 0 -0.84754586 1.0460498                               
 METHOD_PVM_SpatResol : 0.22499999x0.22499999x0                                    
 METHOD_slice_distance : 0.44999999                                                
 METHOD_PVM_ObjOrderScheme: 3                                                      
 RECO_offset : 0 0 0                                                               
 Repetition Time : 1000                                                            
 NI (images per TR, slices) : 30                                                   
 NSLICES : 0                                                                       
 NR (volumes) : 1500                                                               
 Convert pixel value (PV) to floating point value (FP) : FP = (PV/RECO_map_slope + 
RECO_map_offset)/ ACQ_RG                                                           
 RECO_map_slope : 174.24324                                                        
 RECO_map_offset : 0                                                               
 ACQ_RG : 101                                                                      
 Transpose : 0                                                                     
start = [1 0 0 0; 0 1 0 0; 0 0 1 0; 0, 0, 0, 1]                                    
recoff = [1 0 0 0; 0 1 0 0; 0 0 1 0; 0, 0, 0, 1]                                   
ft2mm = [0.22499999 0 0 -6.8624997; 0 0.22499999 0 -4.6124997; 0 0 0.44999999 -6.97
49999; 0, 0, 0, 1]                                                                 
swaps = [-1 0 0 0; 0 -1 0 0; 0 0 1 0; 0, 0, 0, 1]                                  
trans = [1 0 0 0; 0 1 0 -0.84754586; 0 0 1 1.0460498; 0, 0, 0, 1]                  
rotn = [0.99994642 -0.010277266 -0.0012259998 0; 0.010180509 0.99799132 -0.06252723
2 0; 0.0018661461 0.062511407 0.99804252 0; 0, 0, 0, 1]                            
perl2nii = [-1 0 0 0; 0 0 1 0; 0 1 0 0; 0, 0, 0, 1]                                
vx2mm =  rotn * trans * swaps * ft2mm * recoff * start                             
nii =  perl2nii * rotn * trans * swaps * ft2mm * recoff * start                    
NIfTI = [0.22498794 -0.0023123848 0.00055169989 -6.8307076; -0.00041988285 -0.01406
5066 0.44911912 -5.6691856; -0.0022906144 -0.22454804 -0.028137254 4.1979761; 0, 0,
 0, 1]
An unhandled exception occurred at $000000000046CB11:
EInOutError: Access denied
  $000000000046CB11
  $000000000046D1D5
  $000000000046D4C7
  $000000000046E0D0
  $000000000046E143
  $0000000000416829

Which was only resolved after I added write perissions to the 2dseq file:

clusterhost rsfM # ls -lah /mnt/data/ni_data/rsfM/20170623_184053_6256_1_1/13/pdata
/1/2dseq 
-rw-r--r-- 1 chymera wheel 206M Jun 25 22:54 /mnt/data/ni_data/rsfM/20170623_184053
_6256_1_1/13/pdata/1/2dseq
clusterhost rsfM # chmod 764 /mnt/data/ni_data/rsfM/20170623_184053_6256_1_1/13/pda
ta/1/2dseq  

Adding 754 permissions (read+execute) did not help. For reference, the wguest user is part of the wheel group.

I think it's really strange that read permissions are required (perhaps even dangerous?). I would certainly want to avoid the conversion program modifying anything at all in my original data.

Command line usage in Bru2 to not scale the dimensions by 10

Hi, the Bru2Nii conversion tool works perfectly! However, using Bru2 from the command line in windows, does not give me any options to NOT scale the dimensions of the scan by 10. I was wondering if this there is an option input for Bru2 that would allow this? Thanks!

ParaVision 360 1.1 Supports NIFTI Export!

Finally, ParaVision can export the NIFTI format. But, one needs to upgrade to ParaVision 360 with the latest patch 1.1. Most users using PV 6 are still left behind. So, Bru2Nii is still needed before Bruker upgrading PV 6 to support NIFTI.
At least, we can have a standard reference for the converter. The NIFTI files exported from PV 360 1.1 and any converter shall be the same for giving a parameter set.

PS. Check P.10 of PV 360 1.1 release note. http://bruker.telemaxx.net/student/Distribution_Note_and_Installation_GuidePv360V1.1.pdf

MacOS pre-compiled executables don't open

Hi,
I don't manage to open any of the pre-compiled executables for MacOS (console and gui -- "Bru2Nii quit unexpectedly.") while it was working before the last update. Can you help me with that ? Is the problem coming from my environment or is there something wrong with the executables ?
Thank you very much
Céline

ITK Now Supports 2dseq

Hi,

this isn't an issue as such, I simply don't know a better way of contacting you. Last year I added 2dseq reading support to ITK. I've then wrapped that support in ITK into a simple Bruker converter in this repo: https://github.com/spinicist/nanconvert

I think I have covered most corner cases at this point, but there are probably a few I have missed.

Maybe this could be added to the list of Bruker to Nifti converters? Thanks.

issue about conveting

Hi, the tool you developed is very useful. The only issue we met is that it cannot convert T2 image with two echoes. I have attached the raw Buker files and the converted nii.gz file.

Other question:
Previously, after converting to nii, I will divide the reco slope and gain.
Now, the version "Uses PVM_SpatResol for 3D sequences. Uses the slope, the offset, and the gain specified in the parameter files to adjust image scaling"

Does it mean I don't need do the adjust by myself anymore?

Thanks !

Release

Would you be interested in making a release for bru2nii? It would help me provide a more "stable" version to Gentoo users - and would help all other package maintainers make sure we provide the same software across distributions.

Timing is wrong for multi-shot EPI

The conversion tool seems to simply use ##$ACQ_repetition_time as the temporal resolution.
However, for multi-shot EPIs this value has to be multiplied by the number of segments. E.g. for 750ms TR and 2 segments, the time resolution would be 1.5s.
The parameter ##$NSegments=2 is stored in the method file. Would be great if you could include this in a future version.

Convert multiple reco

Hi,
Is there any way to convert multiple reco directories generated by Paravision using Bru2Nii ?

As an example, using DTI acquisitions in PV6, the system compute 2 reco :

  • One with the raw diffusion images
  • Another with the FA/Trace/.. volumes.

The 2dseq are located in : pvdataset/[num-session]/pdata/[num-reco]/2dseq

I tried to give the 2nd reco directory as an input to Bru2 but it failed to find the reco file. Indeed, there is no such file in the second reco directory generated by paravision.

Inconsistent Affine Matrix Among Different Way of Converting

We are trying to build a working flow of our fMRI processing. The first step is converting Bruker's data to NIFTI. There are several ways of converting including using your Bru2Nii. But, I found the affine transformation is different among these methods. Below is the original parameters from Bruker, Bru2Nii, bruker2nifti and Bruker's DICOM+AFNI's to3d. Any ideas? PS. I am cross-posting this in bruker2nifti as well.

ParaVision 6.0.1
3D FLASH
##$PVM_Fov=( 3 )
58 58 58
##$PVM_SpatResol=( 3 )
0.453125 0.453125 0.453125
##$PVM_SPackArrSliceOrient=( 1 )
coronal
##$PVM_SPackArrReadOrient=( 1 )
H_F
##$PVM_SPackArrReadOffset=( 1 )
0
##$PVM_SPackArrPhase1Offset=( 1 )
0
##$PVM_SPackArrPhase2Offset=( 1 )
0
##$PVM_SPackArrSliceOffset=( 1 )
0
##$PVM_SPackArrGradOrient=( 1, 3, 3 )
0.241395201113481 0.0866782944696308 0.966548100276038
0.970351084097186 -0.00911025585436366 -0.24152800423488
-0.0121297349846693 0.996194698091746 -0.0863075490504608
##$VisuCoreOrientation=( 1, 9 )
0.970351084097186 -0.00911025585436366 0.24152800423488
0.241395201113481 0.0866782944696308 -0.966548100276038
-0.0121297349846693 0.996194698091746 0.0863075490504608

neurolabusc/Bru2Nii v1.0.20170719
qform_code 252 1 0
sform_code 254 1 1
quatern_b 256 1 0.0
quatern_c 260 1 0.0
quatern_d 264 1 0.0
qoffset_x 268 1 0.0
qoffset_y 272 1 0.0
qoffset_z 276 1 0.0
srow_x 280 4 0.43969 0.109382 0.005496 -35.769691
srow_y 296 4 0.109442 -0.437967 -0.039108 23.712318
srow_z 312 4 0.004128 -0.039276 0.451401 -26.848299

SebastianoF/bruker2nifti Sep 4, 2017 Python 2.7
qform_code 252 1 2
sform_code 254 1 1
quatern_b 256 1 -0.000757
quatern_c 260 1 -0.043614
quatern_d 264 1 -0.991602
qoffset_x 268 1 28.997601
qoffset_y 272 1 28.999701
qoffset_z 276 1 28.7724
srow_x 280 4 -0.439667 0.10943 -0.004123 28.997601
srow_y 296 4 -0.109384 -0.437991 0.039286 28.999701
srow_z 312 4 0.005483 0.039105 0.451403 28.7724

Converting Bruker DICOM to NIFTI by AFNI's to3d
qform_code 252 1 1
sform_code 254 1 1
quatern_b 256 1 0.086631
quatern_c 260 1 -0.670329
quatern_d 264 1 0.732007
qoffset_x 268 1 34.79163
qoffset_y 272 1 -28.773438
qoffset_z 276 1 18.542217
srow_x 280 4 -0.43969 -0.109382 0.005496 34.79163
srow_y 296 4 0.004128 -0.039276 -0.451401 30.91342
srow_z 312 4 0.109442 -0.437967 0.039108 18.542217

Bru2 does not respect output file format

Bru2 -o /mnt/data9/NIdata/ofM.dr/QuickMELODIC/convert_resize/16.nii /home/chymera/NIdata/ofM.dr/20151027_141609_4011_ofM_1_1/16

Actually saves a file to /mnt/data9/NIdata/ofM.dr/QuickMELODIC/convert_resize/16.nii16.nii. Running the command again saves the file into /mnt/data9/NIdata/ofM.dr/QuickMELODIC/convert_resize/1_16.nii16.nii. This is not very good behaviour if one wants to be able to control eactly where the output goes to (which one would in order to write a decent pipeline).

Can you please modify this?

bru2nii gives different output than pvconv+fslchfiletype

I have a bruker series from an experiment over here, which I would like to analyze with FSL's melodic.

Depending on whether prior to melodic I convert the file to nifti via pcvonv and fslchfiletype:

pvconf -series 16
fslchfiletype NIFTI _16.img
melodic -i _16.nii -o pf16_melodic --report -v

or via bru2nii:

Bru2 -o bru2nii 16
melodic -i bru2nii16.nii -o bru2nii16_melodic --report -v
melodic -i bru2nii16.nii -o bru2nii16_melodic_10 --report -d 10 -v

I get different results: 10 components automatically from the first, and over 360 components from the second (see pf16_melodic and bru2nii16_melodic respectively). Of course I can restrict the number of components manually, which gives me 10 components from the bru2nii conversion as well, though these differ quite a bit.

I am trying to figure out what the difference between the files is, and which one is more "correct".
As it stands I think the header of the file converted with bru2nii looks more sane than what came out of pvconv and fslchfiletype. Could you also check and tell me what you think about the issue? Is there an easy way to copy the header (all the header and only the header) from one .nii file to another so we can check whether this is what is causing the great difference in behaviour with melodic?

All fies mentioned above (and the source needed to reproduce everything) are archived here.

Output naming not respected in current live version (7f5815c)

I am looking to use 7f5815c to benefit from your newest fix.

Sadly, the output naming is not respected, which breaks the pipeline.

Bru2 -v -a -o ~/13 /mnt/data/ni_data/rsfM/20170623_184053_6256_1_1/13

produces ~/X13P113.nii and not ~/13.nii. This is also the case with variations of the above, including:

Bru2 -v -a -o ~/13.nii /mnt/data/ni_data/rsfM/20170623_184053_6256_1_1/13
Bru2 -v -a -o /home/wguest/13 /mnt/data/ni_data/rsfM/20170623_184053_6256_1_1/13
Bru2 -v -a -o ~/13 /mnt/data/ni_data/rsfM/20170623_184053_6256_1_1/13/acqp

-f option descroption

The Bru2 help tells me it has this option:

-f force conversion of localizers images (multiple slice orientations)

  • are you sure you want to say "localizers images"? I think "localizer images" would be a better way to phrase it, as you are referring to a type of images: the localizer type.
  • what does "(multiple slice orientations)" refer to?

support DWI

Hi.
Would it be possible to have support for DWI to get both bvec and bval, in addition to the nifti?

AFAIK:
bvals can be found under PVM_DwEffBvals in the corresponding method file for the scan.
bvec are found under PVM_DwGradRead, PVM_DwGrandPhase, and PVM_DwGradeSlice in the same file.

Missing .nii Filename Extension for Bru2 Output

When I used the command line Bru2 v1.0.20170707 on macOS 10.12.6, the output doesn't have the .nii filename extension. It will be more convenient to create the NIFTI file with the .nii extension.

Here is the command I used for conversion.
Bru2 -o /somewhere/ -a -p -f /somewhere2/subject

What's the proper way to compile this?

Hi, I've been looking for a more modern solution of converting bruker files to nifti for a while now - and I am happy to have stumbled across this. I had hoped this fucntionality would be offered by nibabel at some point, but Bru2Nii also seems nice.

I would like to package this for my distribution (Gentoo), but unlike for many other packages, I can't find a recomended way to compile thisanywhere in the repo files. Could you add that to the README or just tell me here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.