Closed Nagle2036 closed 3 months ago
The data looks fine to me (commands run on my Mac).
The silent exit might be related to a missing library runtime library dependency.
Can you read an image? Try
PrintHeader structural_brain.nii.gz
Could it be missing Visual Studio libraries? That was the problem in #1742 but in that case there was an error message printed.
Just guessing, I don't know much about Windows.
Hi cookpa,
Running PrintHeader structural_brain.nii.gz
also provides no error message or output.
What is the library runtime dependency that you mentioned? How can I source this if it is indeed missing?
Thanks! Alex
Maybe this
The ANTs Windows binaries are compiled on a Github runner, OS is Windows Server 2022, and Visual Studio 19.
I installed the latest Microsoft Visual C++ redistributable for Visual Studio 19. When running the code again, the output file was actually generated. However, when opening it in MRIcron image viewing software, the file was blank. Indeed, it said 'No Images Loaded' in the bottom left corner.
Why might this be the case?
Thanks for your help so far!
Can you try PrintHeader again, on your output file
The PrintHeader
command does work. See the output below. As you can see, the voxel spacing gives some interesting numbers...Different to the 0.8x0.8x0.8 of the original image, but definitely not the desired 3x3x3.3.
C:\Users\alexn\Desktop\structurals\P004>PrintHeader structural_brain_resampled.nii.gz
Spacing [82.8, 118.8, 127.6]
Origin [72.3214, 88.2241, -160.868]
Direction
-0.999003 0.0122566 0.0429255
-0.0101355 -0.998733 0.0492878
0.0434752 0.0488036 0.997862
Size : 3 3 3
Image Dimensions : [3, 3, 3]
Bounding Box : {[72.3214 88.2241 -160.868], [320.721 444.624 221.932]}
Voxel Spacing : [82.8, 118.8, 127.6]
Intensity Range : [0, 908]
Mean Intensity : 33.6296
Direction Cos Mtx. :
-0.999003 0.0122566 0.0429255
-0.0101355 -0.998733 0.0492878
0.0434752 0.0488036 0.997862
Voxel->RAS x-form :
Image Metadata:
ITK_original_direction of unsupported type class itk::Matrix<double,3,3>
ITK_original_spacing of unsupported type class std::vector<double,class std::allocator<double> >
ITK_sform_corrected = NO
bitpix = 32
cal_max = 0
cal_min = 0
datatype = 16
dim[0] = 3
dim[1] = 3
dim[2] = 3
dim[3] = 3
dim[4] = 1
dim[5] = 1
dim[6] = 1
dim[7] = 1
dim_info = 0
intent_code = 0
intent_p1 = 0
intent_p2 = 0
intent_p3 = 0
nifti_type = 1
pixdim[0] = 0
pixdim[1] = 82.8
pixdim[2] = 118.8
pixdim[3] = 127.6
pixdim[4] = 0
pixdim[5] = 0
pixdim[6] = 0
pixdim[7] = 0
qfac = 1
qform_code = 1
qform_code_name = NIFTI_XFORM_SCANNER_ANAT
qoffset_x = -72.3214
qoffset_y = -88.2241
qoffset_z = -160.868
qto_xyz of unsupported type class itk::Matrix<float,4,4>
quatern_b = 0.0245364
quatern_c = -0.0216121
quatern_d = 0.0056011
scl_inter = 0
scl_slope = 1
sform_code = 1
sform_code_name = NIFTI_XFORM_SCANNER_ANAT
slice_code = 0
slice_duration = 0
slice_end = 0
slice_start = 0
srow_x = 82.7175 -1.45608 -5.47729 -72.3214
srow_y = 0.839217 118.65 -6.28912 -88.2241
srow_z = 3.59975 5.79787 127.327 -160.868
toffset = 0
vox_offset = 352
xyzt_units = 2
Ah, I think it resampled to 3x3x3 voxels instead of resampling the spacing. Try
ResampleImageBySpacing 3 structural_brain.nii.gz structural_brain_resampled.nii.gz 3 3 3.3 0
Alternatively,
ResampleImage 3 structural_brain.nii.gz structural_brain_downsampled.nii.gz 3x3x3.3 0
the 1/0 flag after the AxBxC spec is 1 for size (this many voxels) and 0 for spacing (make voxels AxBxCmm)
Both of these work! Thanks so much, that's a real help.
Great, thanks for reporting with a reproducible example.
I've updated the wiki to let others know about the library requirements
https://github.com/ANTsX/ANTs/wiki/Installing-ANTs-release-binaries
Operating system and version
Windows 10
CPU architecture
Unknown
ANTs code version
2.5.3-g98bf76d
ANTs installation type
Downloaded Github release binaries
Summary of the problem
Hi there. I am trying to run ResampleImage to resample a 3-dimensional Nifti file to a voxel size of 3x3x3.3. To do this, I have been using the following code in my Windows Command Prompt:
ResampleImage 3 structural_brain.nii.gz structural_brain_downsampled.nii.gz 3x3x3.3 1
The command throws no errors, but no output file is provided. I have tried running the command again by specifying the full paths to the command executable and the input/output files, but the same issue occurs.
I have also tried running the command with output redirection (as below) in order to capture any hidden error messages. The resample_log.txt file is outputted, but it is empty.
ResampleImage 3 structural_brain.nii.gz structural_brain_downsampled.nii.gz 3x3x3.3 1 > resample_log.txt 2>&1
The absence of any output, or error, also occurs with other simple commands other than ResampleImage, such as file copying:
ImageMath 3 structural_brain_copy.nii.gz m structural_brain.nii.gz
However, typing these commands by themselves does provide the usage information in the terminal, which shows that the commands are being recognised, and are located in the right path. I would appreciate any help that you can provide with this issue.
Thanks, Alex
Commands to reproduce the problem.
Please see the file that I am working with,
structural_brain.nii.gz
, attached. structural_brain.nii.gzCommand 1: Image resampling.
ResampleImage 3 structural_brain.nii.gz structural_brain_downsampled.nii.gz 3x3x3.3 1
Command 2: Image resampling with output redirection.
ResampleImage 3 structural_brain.nii.gz structural_brain_downsampled.nii.gz 3x3x3.3 1 > resample_log.txt 2>&1
Command 3: Image copying.
ImageMath 3 structural_brain_copy.nii.gz m structural_brain.nii.gz
Output of the command with verbose output.
No output provided.
Data to reproduce the problem
Please see the file that I am working with,
structural_brain.nii.gz
, attached. structural_brain.nii.gz