Skip to content

Neuroimaging Informatics Technology Initiative

Sections
Personal tools
You are here: Home
phorum - NIfTI Message Board - nifti_image_write_bricks
NIfTI Message Board

 New Topic  |  Go to Top  |  Go to Topic  |  Search   Previous Message  |  Next Message 
 nifti_image_write_bricks
Author: Cinly OOI (---.cmbg.cable.ntl.com)
Date:   10-06-08 19:55

Dear All,

Can I mix nifti_image_read_bricks() with nifti_image_write_bricks() ??

The test program below failed at second nifti_image_read_bricks() unexpectedly. Can someone have a look at tell me where I go wrong?

OUTPUT:
----------------
++ WARNING: nifti_read_buffer(/tmp/a.nii):
data bytes needed = 96
data bytes input = 0
number missing = 96 (set to 0)
** failed to read brick 1 from file '/tmp/a.nii'
** NWAD: no brick data to write (0x0,0,0)
----------------
"** failed ..." : second nifti_image_read_bricks()
"* NWAD ..." : second nifti_image_write_bricks(). Expected, since read() failed.

However, if we remove all nifti_image_write_bricks() read will succeed.


TEST_PROGRAM
-------------------
void main() {
nifti_image *nim = calloc(1, sizeof(nifti_image));

nim->dim[0] = nim->ndim = 4;
nim->dim[1] = nim->nx = 4;
nim->dim[2] = nim->ny = 3;
nim->dim[3] = nim->nz = 2;
nim->dim[4] = nim->nt = 2;
nim->dim[5] = nim->nu = 1;
nim->dim[6] = nim->nv = 1;
nim->dim[7] = nim->nw = 1;
nim->nvox = nim->nx * nim->ny * nim->nz * nim->nt;
nim->datatype = NIFTI_TYPE_FLOAT32;
nim->nbyper = sizeof(float);
nim->data = malloc(48 * sizeof(float));
nifti_set_filenames(nim, "/tmp/a.nii", 0, 0);
nifti_image_write(nim);
nifti_image_free(nim);

nim = nifti_image_read("/tmp/a.nii", 0);
nifti_brick_list NBL;

int vol = 0;
nifti_image_load_bricks(nim, 1, &vol, &NBL);
nifti_image_write_bricks(nim, &NBL);
vol = 1;
nifti_image_load_bricks(nim, 1, &vol, &NBL); //FAIL
nifti_image_write_bricks(nim, &NBL);
}



 Reply To This Message  |  Flat View   Newer Topic  |  Older Topic 

 Topics Author  Date
 nifti_image_write_bricks  
Cinly OOI 10-06-08 19:55 
 Re: nifti_image_write_bricks  
rick reynolds 10-07-08 10:47 
 Re: nifti_image_write_bricks  
rick reynolds 10-07-08 15:27 
 Re: nifti_image_write_bricks  new
Cinly OOI 10-08-08 08:46 
 Re: nifti_image_write_bricks  
Cinly OOI 10-08-08 10:37 
 Re: nifti_image_write_bricks  new
rick reynolds 10-08-08 14:35 
 Re: nifti_image_write_bricks  
Cinly OOI 10-08-08 14:48 


 New Topic  |  Go to Top  |  Go to Topic  |  Search 
 Reply To This Message
 Your Name:
 Your E-mail:
 Subject:
   
 

Powered by Plone

phorum.org

This site conforms to the following standards: