Hi Doug,
when I try to use mri_binarize with -match, certain values, especially ones smaller than about 50, are not found.
This happens with the original MNC file as well as with NIFTI files that I converted from the MNC file.
When I load the MNC file in Matlab, all the values that mri_binarize did not find show up.
The data type of the MNC file is unsigned byte; it is read as 32bit integer in Matlab.
Caspar



2014/1/22 Douglas N Greve <greve@nmr.mgh.harvard.edu>

Can you describe the potential problem with mri_binarize more fully?


On 01/22/2014 12:50 PM, Caspar M. Schwiedrzik wrote:
> or, since the correct values display if I load the same MNC file with
> Matlab, it could be a problem with mri_binarize?
>
>
> 2014/1/22 Bruce Fischl <fischl@nmr.mgh.harvard.edu
> <mailto:fischl@nmr.mgh.harvard.edu>>
>
>     then is seems like the problem is with your mnc, not with anything
>     we are doing, right?
>
>     On Wed, 22 Jan 2014, Caspar M. Schwiedrzik wrote:
>
>         same thing
>
>
>         2014/1/22 Bruce Fischl <fischl@nmr.mgh.harvard.edu
>         <mailto:fischl@nmr.mgh.harvard.edu>>
>               and what if you run it on the mnc?
>               On Wed, 22 Jan 2014, Caspar M. Schwiedrzik wrote:
>
>                     mri_binarize --i paxinos-MNI.nii --match 1 --o
>                     labels/1.nii
>
>                     $Id: mri_binarize.c,v 1.26.2.1 2011/04/08 15:40:50
>                     greve Exp $
>                     cwd
>
>         /rdata3/space3/data/cschwiedrz/cooked/anatomicals/mni_macaque
>                     cmdline mri_binarize --i paxinos-MNI.nii --match 1
>                     --o labels/1.nii
>                     sysname  Linux
>                     hostname wiener
>                     machine  x86_64
>                     user     cschwiedrz
>
>                     input      paxinos-MNI.nii
>                     frame      0
>                     nErode3d   0
>                     nErode2d   0
>                     output     labels/1.nii
>                     Binarizing based on matching values
>                     nMatch 1
>                      0     1
>                     binval        1
>                     binvalnot     0
>                     Found 0 values in range
>                     Counting number of voxels
>                     Found 0 voxels in final mask
>                     mri_binarize done
>
>
>
>                     2014/1/22 Bruce Fischl <fischl@nmr.mgh.harvard.edu
>         <mailto:fischl@nmr.mgh.harvard.edu>>
>                           can you send us the full command line and
>                     screen output of the
>                           mri_binarize command?
>                           On Wed, 22 Jan 2014, Caspar M. Schwiedrzik
>                     wrote:
>
>                                 Hi Bruce,
>                                 I am confused, too.
>                                 If the conversion is proper, why does
>                     mri_binarize
>                                 not find values below
>                                 ~53? when I call mri_binarize with
>                     -match on the MNC
>                                 file or on any of the
>                                 converted NIFTI files?
>                                 Caspar
>
>
>
>
>                                 2014/1/22 Bruce Fischl
>                     <fischl@nmr.mgh.harvard.edu
>         <mailto:fischl@nmr.mgh.harvard.edu>>
>                                       Hi Caspar
>
>                                       now, I'm confused. So it sounds
>                     like
>                                 mri_convert is doing the
>                                       conversion properly then?
>                                       Bruce
>                                       On Wed, 22 Jan 2014, Caspar M.
>                     Schwiedrzik
>                                 wrote:
>
>                                             Hi Bruce,
>                                             mri_diff does not return any
>                                 differences. However,
>                                             when I load the MNC file
>                                             into Matlab using loadminc
>
>
>
>         (http://www.mathworks.com/matlabcentral/fileexchange/32644-loadminc),
>                                             I do
>                                             retain all the values
>                     between 0 and 255.
>                                 Also, I
>                                             have something like an
>                                             annotation file for the MNC
>                     file that
>                                 lists values
>                                             between 0 and 255.
>                                             The MNC is unsigned byte.
>                                             Caspar
>
>
>                                             2014/1/22 Bruce Fischl
>                                 <fischl@nmr.mgh.harvard.edu
>         <mailto:fischl@nmr.mgh.harvard.edu>>
>                                                   how do you know that
>                     the values
>                                 were there
>                                             before? Try running
>                                                   mri_diff on the .nii
>                     and the .mnc
>                                 and see if
>                                             it finds any
>                                                   differences
>                                                   Bruce
>
>
>                                                   On Wed, 22 Jan 2014,
>                     Caspar M.
>                                 Schwiedrzik
>                                             wrote:
>
>                                                         Hi Bruce,
>                                                         I have tried the
>                     two
>                                 following commands,
>                                             and various
>                                                         flags on
>                     mri_convert:
>         mnc2nii -nii
>                     -int
>                                 paxinos-MNI.mnc
>                                             paxinos-MNI.nii
>         mri_convert -i
>                                 paxinos-MNI.mnc -o
>                                             paxinos-MNI.nii
>
>                                                         Yhe output of
>                     the latter
>                                 would be:
>         mri_convert -i
>                                 paxinos-MNI.mnc -o
>                                             paxinos-MNI.nii
>                                                         $Id:
>                     mri_convert.c,v
>                                 1.179.2.2
>                                             2011/05/16 20:53:47
>                                                         greve Exp $
>         reading from
>                                 paxinos-MNI.mnc...
>         TR=0.00,
>                     TE=0.00, TI=0.00,
>                                 flip
>                                             angle=0.00
>                                                         i_ras = (1, 0,
>                     0)
>                                                         j_ras = (0, 1,
>                     0)
>                                                         k_ras = (0, 0,
>                     1)
>         writing to
>                                 paxinos-MNI.nii...
>
>                                                         for mri_convert,
>                     --nochange,
>                                 -odt
>                                             float/int/uchar,
>         --no_scale 1 all
>                     do not
>                                                         make a
>                     difference.
>
>                                                         It could be that
>                     the problem
>                                 arises once
>                                             I call
>         mri_binarize
>                     afterwards. I
>                                                         know that there
>                     are values
>                                 between 1 and
>                                             256 in the
>                                                         MNC file, but
>                     when I
>                                                         call
>                     mri_binarize with
>                                 -match on the MNC
>                                             file or on
>                                                         any of the
>                     converted
>                                                         NIFTI files, it
>                     does not
>                                 find any values
>                                             lower than
>                                                         53 or so.
>
>                                                         Caspar
>
>
>
>
>         2014/1/22 Bruce
>                     Fischl
>
>         <fischl@nmr.mgh.harvard.edu <mailto:fischl@nmr.mgh.harvard.edu>>
>         Hi Caspar
>
>         hmm, I
>                     don't know why
>                                 that would
>                                             be the case.
>                                                         Can you send the
>         full
>                     command line and
>                                 screen
>                                             output?
>         cheers
>         Bruce
>         On Wed, 22
>                     Jan 2014,
>                                 Caspar M.
>                                             Schwiedrzik
>                                                         wrote:
>
>               Hi!
>               I am
>                     having some
>                                 troubles
>                                             converting MNC
>                                                         files to
>               NII
>                     while
>                                 preserving the
>
>                     exact values in
>                                 the MNC
>                                             file. I have
>                                                         tried to use
>
>                     mri_convert and
>                                 mnc2nii,
>               but
>                     in both
>                                 cases, the
>                                             values in the
>                                                         file output get
>
>                     changed. The
>                                 help of
>
>                     mri_convert
>                                 mentions that
>                                             the output for
>                                                         MNC files
>               may
>                     not work.
>               Is
>                     there a
>                                 workaround or a
>                                             recommended
>         procedure to
>
>                     convert MNC into
>                                 NII?
>
>                     Thanks, Caspar
>
>
>
>
>
>
>
>
>                                                         The information
>                     in this
>                                 e-mail is
>                                             intended only for
>                                                         the person to
>                     whom
>                                                         it is
>         addressed. If
>                     you believe
>                                 this e-mail
>                                             was sent to
>                                                         you in error and
>                     the
>                                                         e-mail
>         contains patient
>                                 information, please
>                                             contact the
>         Partners
>                     Compliance
>         HelpLine at
>
>         http://www.partners.org/complianceline .
>                                             If the
>                                                         e-mail was sent
>                     to you
>                                                         in error
>                                                         but does not
>                     contain patient
>                                             information, please
>         contact the
>                     sender
>                                                         and properly
>         dispose of the
>                     e-mail.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Freesurfer mailing list
> Freesurfer@nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

--
Douglas N. Greve, Ph.D.
MGH-NMR Center
greve@nmr.mgh.harvard.edu
Phone Number: 617-724-2358
Fax: 617-726-7422

Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting
FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2
www.nmr.mgh.harvard.edu/facility/filedrop/index.html
Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer