From zijdenbos at gmail.com Fri Jun 4 15:22:53 2021 From: zijdenbos at gmail.com (Alex Zijdenbos) Date: Fri, 4 Jun 2021 15:22:53 -0400 Subject: [MINC-users] Odd behaviour with recent versions of dcm2mnc/mincreshape In-Reply-To: References: Message-ID: Followup: we found a simpler way to demonstrate this issue: $ make_phantom in.mnc && mincreshape in.mnc out.mnc && mincinfo -attvalue xspace:spacing -attvalue yspace:spacing -attvalue zspace:spacing out.mnc Copying chunks:................................................................................................................................Done. zspace zspace zspace Massina Yahia will also pull-request a fix for this in the near future. Have a good weekend! :-) -- Alex On Mon, May 31, 2021 at 11:30 PM Alex Zijdenbos wrote: > Hi all, > > Stumbled into something rather strange: > > $ dcm2mnc DICOM/ADNI_126_S_0709_MR_IR-FSPGR-Repeat MINC_dcm2mnc_2.3.01 > $ mincheader MINC_dcm2mnc_2.3.01/*/*mnc | grep spacing > xspace:spacing = "regular__" ; > yspace:spacing = "regular__" ; > zspace:spacing = "regular__" ; > $ mincreshape MINC_dcm2mnc_2.3.01/*/*mnc MINC_dcm2mnc_2.3.01/reshaped.mnc > $ mincheader MINC_dcm2mnc_2.3.01/reshaped.mnc | grep spacing > xspace:spacing = "yspace" ; > yspace:spacing = "yspace" ; > zspace:spacing = "yspace" ; > > In other words, the :spacing attribute gets mangled by what *should* > be a no-op. This is using: > $ dcm2mnc -version > program: 2.3.01 built Dec 10 2020 01:01:35 > libminc: 2.4.03 > netcdf : 4.5.0 of Jun 26 2018 10:58:21 $ > HDF5 : 1.8.20 > > If I do the exact same thing with this older version: > $ dcm2mnc -version > program: 2.0.07 built Mar 19 2014 16:54:51 > libminc: 2.2.00 > netcdf : 3.6.1 of Mar 19 2014 16:53:18 $ > HDF5 : 1.8.9 > > All seems to work as expected (all :spacing attributes remain > "regular__"). Doing a quick comparison of the headers of the MINC volumes > generated by these two versions of dcm2mnc, a few differences appear: > $ diff <( mincheader MINC_dcm2mnc_2.0.07/*/*.mnc | grep spac | sort) <( > mincheader MINC_dcm2mnc_2.3.01/*/*.mnc | grep spac | sort) > 3c3 > < double xspace(xspace) ; > --- > > double xspace ; > 10d9 > < xspace = -100.899, -99.6994, -98.4994, -97.2994, -96.0994, -94.8994, > 11a11 > > xspace = 97.1005 ; > 14d13 > < xspace:dimorder = "xspace" ; > > Further, if I use the "new" mincreshape on the "old" volume or vice versa, > the spacing attributes remain "regular__". It's only the combination of > both "new" dcm2mnc and "new" mincreshape that results in this. > > Unfortunately I can't actually distribute the source data, but it is ADNI > data, and this is not an isolated case - this pretty much happens on most > volumes that I pick up. > > Anybody any idea what we might be looking at here? > > Thanks, > > -- A > From sean at rogue-research.com Wed Jun 23 14:27:43 2021 From: sean at rogue-research.com (Sean McBride) Date: Wed, 23 Jun 2021 14:27:43 -0400 Subject: [MINC-users] Can MINC tools be used to crop a dataset? Message-ID: <20210623182743.387507594@mail.rogue-research.com> Hi MINC users, I only know how to do one or two simple things with MINC tools, but now I'm looking to do something a bit more complex, and I'm hoping someone can point me in the right direction. I have a huge dataset that, on account of its hugeness, is slow to deal with. But in fact most of the voxels are just emptiness. Is it possible for me to specify a range in x,y,z of voxels that I want to keep and then create a new smaller MINC file? Thanks, Sean From claude at bic.mni.mcgill.ca Wed Jun 23 14:37:55 2021 From: claude at bic.mni.mcgill.ca (Claude LEPAGE) Date: Wed, 23 Jun 2021 14:37:55 -0400 Subject: [MINC-users] Can MINC tools be used to crop a dataset? In-Reply-To: <20210623182743.387507594@mail.rogue-research.com> Message-ID: <202106231837.15NIbtKC016944@login1.bic.mni.mcgill.ca> Hi Sean, I feel I know an answer for this. % mincbbox -help Command-specific options: -threshold: Real value threshold for bounding box. Default value: 0 -one_line: Output on one line (default): start_x y z width_x y z -two_lines: Output on two lines: start_x y z \n width_x y z -mincresample: Output format for mincresample: (-step x y z -start x y z -nelements x y z -mincreshape: Output format for mincreshape: (-start x,y,z -count dx,dy,dz -minccrop: Output format for minccrop: (-xlim x1 x2 -ylim y1 y2 -zlim z1 z2 Options for logging progress. Default = -verbose. -verbose: Write messages indicating progress -quiet: Do not write log messages -debug: Print out debug info. Generic options for all commands: -help: Print summary of command-line options and abort -version: Print version number of program and exit Usage: mincbbox [] mincbbox [-help] You can use it in combination with -threshold and output the instructions for use with mincresample, mincreshape or minccrop. I'll let you discover the details. After that, I would suggest a bit of padding around the part of the image that you want to keep (autocrop -extend). Claude > > Hi MINC users, > > I only know how to do one or two simple things with MINC tools, but now I'm looking to do something a bit more complex, and I'm hoping someone can point me in the right direction. > > I have a huge dataset that, on account of its hugeness, is slow to deal with. But in fact most of the voxels are just emptiness. Is it possible for me to specify a range in x,y,z of voxels that I want to keep and then create a new smaller MINC file? > > Thanks, > > Sean >