------------------------------------------------------------------------------
| 152 | |
| 153 | //------------------------------------------------------------------------------ |
| 154 | void vtkNIFTIImageHeader::GetHeader(nifti_1_header* hdr) |
| 155 | { |
| 156 | hdr->sizeof_hdr = NIFTI1HeaderSize; |
| 157 | memcpy(hdr->magic, this->Magic, sizeof(hdr->magic)); |
| 158 | memset(hdr->data_type, '\0', 10); |
| 159 | memset(hdr->db_name, '\0', 18); |
| 160 | hdr->extents = 0; |
| 161 | hdr->session_error = 0; |
| 162 | hdr->regular = 0; |
| 163 | hdr->dim_info = this->DimInfo; |
| 164 | hdr->intent_p1 = vtkNIFTINormalizeFloat(this->IntentP1); |
| 165 | hdr->intent_p2 = vtkNIFTINormalizeFloat(this->IntentP2); |
| 166 | hdr->intent_p3 = vtkNIFTINormalizeFloat(this->IntentP3); |
| 167 | hdr->intent_code = static_cast<short>(this->IntentCode); |
| 168 | hdr->datatype = static_cast<short>(this->DataType); |
| 169 | hdr->bitpix = static_cast<short>(this->BitPix); |
| 170 | hdr->slice_start = this->SliceStart; |
| 171 | for (int i = 0; i < 8; i++) |
| 172 | { |
| 173 | hdr->dim[i] = static_cast<short>(this->Dim[i]); |
| 174 | hdr->pixdim[i] = vtkNIFTINormalizeFloat(this->PixDim[i]); |
| 175 | } |
| 176 | hdr->vox_offset = static_cast<float>(this->VoxOffset); |
| 177 | strncpy(hdr->intent_name, this->IntentName, sizeof(hdr->intent_name) - 1); |
| 178 | hdr->intent_name[sizeof(hdr->intent_name) - 1] = '\0'; |
| 179 | hdr->scl_slope = vtkNIFTINormalizeFloat(this->SclSlope); |
| 180 | hdr->scl_inter = vtkNIFTINormalizeFloat(this->SclInter); |
| 181 | hdr->cal_min = vtkNIFTINormalizeFloat(this->CalMin); |
| 182 | hdr->cal_max = vtkNIFTINormalizeFloat(this->CalMax); |
| 183 | hdr->slice_duration = vtkNIFTINormalizeFloat(this->SliceDuration); |
| 184 | hdr->toffset = vtkNIFTINormalizeFloat(this->TOffset); |
| 185 | hdr->glmax = 0; |
| 186 | hdr->glmin = 0; |
| 187 | hdr->slice_end = this->SliceEnd; |
| 188 | hdr->slice_code = this->SliceCode; |
| 189 | hdr->xyzt_units = this->XYZTUnits; |
| 190 | strncpy(hdr->descrip, this->Descrip, sizeof(hdr->descrip) - 1); |
| 191 | hdr->descrip[sizeof(hdr->descrip) - 1] = '\0'; |
| 192 | strncpy(hdr->aux_file, this->AuxFile, sizeof(hdr->aux_file) - 1); |
| 193 | hdr->aux_file[sizeof(hdr->aux_file) - 1] = '\0'; |
| 194 | hdr->qform_code = static_cast<short>(this->QFormCode); |
| 195 | hdr->sform_code = static_cast<short>(this->SFormCode); |
| 196 | hdr->quatern_b = vtkNIFTINormalizeFloat(this->QuaternB); |
| 197 | hdr->quatern_c = vtkNIFTINormalizeFloat(this->QuaternC); |
| 198 | hdr->quatern_d = vtkNIFTINormalizeFloat(this->QuaternD); |
| 199 | hdr->qoffset_x = vtkNIFTINormalizeFloat(this->QOffsetX); |
| 200 | hdr->qoffset_y = vtkNIFTINormalizeFloat(this->QOffsetY); |
| 201 | hdr->qoffset_z = vtkNIFTINormalizeFloat(this->QOffsetZ); |
| 202 | for (int i = 0; i < 4; i++) |
| 203 | { |
| 204 | hdr->srow_x[i] = vtkNIFTINormalizeFloat(this->SRowX[i]); |
| 205 | hdr->srow_y[i] = vtkNIFTINormalizeFloat(this->SRowY[i]); |
| 206 | hdr->srow_z[i] = vtkNIFTINormalizeFloat(this->SRowZ[i]); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | //------------------------------------------------------------------------------ |
| 211 | void vtkNIFTIImageHeader::SetHeader(const nifti_2_header* hdr) |