Functions | |
| elseif (foundKeyword('DWMRI_GRADIENT_', cs))[iGNr | |
| elseif (foundKeyword('DWMRI_B-VALUE', cs)) headerInfo.bvalue | |
| elseif (foundKeyword('MODALITY', cs)) headerInfo.modality | |
| elseif (foundKeyword('MEASUREMENT FRAME:', cs)) iMF | |
| elseif (foundKeyword('SPACE ORIGIN:', cs)) iSO | |
| elseif (foundKeyword('SPACE UNITS:', cs)) headerInfo.spaceunits | |
| elseif (foundKeyword('CENTERINGS:', cs)) headerInfo.centerings | |
| elseif (foundKeyword('KINDS:', cs)) headerInfo.kinds | |
| elseif (foundKeyword('THICKNESSES:', cs)) sThicknesses | |
| elseif (foundKeyword('SIZES:', cs)) iSizes | |
| end | elseif (foundKeyword('SPACE DIRECTIONS:', cs))%in case of a tensor volume there are 4 dimensions |
| elseif (foundKeyword('SPACE:', cs)) headerInfo.space | |
| elseif (foundKeyword('DIMENSION:', cs)) headerInfo.dimension | |
| elseif (foundKeyword('DATA FILE:', cs)) headerInfo.datafile | |
| elseif (foundKeyword('ENCODING:', cs)) headerInfo.encoding | |
| elseif (foundKeyword('ENDIAN:', cs)) headerInfo.endian | |
| elseif (foundKeyword('TYPE:', cs)) headerInfo.type | |
| return | elseif (foundKeyword( 'CONTENT:', cs)) headerInfo.content |
| function | error (['Original measurement frame needed to transform tensor back into original measurement frame']) |
| fprintf ('Type has not been adapted, your data type is not unsupported.\n') | |
| otherwise | fprintf ('Unknown type:%s\n', headerInfo.type) |
| else | fprintf ('Warning:File is not RAS, make sure subsequent matlab processing is consistent!\n') |
| headerInfo | gradients (iGNr+1,:) |
| return end | if (strcmp(csU(1:lenKeyword), keyWordU)) fk |
| if (len< lenKeyword) fk=0 | |
| else | if (~iLastWasDelimiter) indxList |
| if (numDelimiters >=1) sl | |
| if (isempty(assgnLoc)) dwiGradient | |
| if (transformDT &strcmp(headerInfo.kinds(1),'3D-masked-symmetric-matrix')) headerInfo | |
| return end | if (strcmp(headerInfo.kinds(1),'3D-masked-symmetric-matrix'))%assume tensor data%assumed default centerings for tenssor data |
| end | if (strcmp(headerInfo.data,'')==1) fprintf('No data.\n') |
| only implemented for RAS | if (iLocation >0) iIsRas |
| if (strncmp(cs, 'No volume', 9)) fprintf('%s\n' | |
| iMF (3) iMF(6) iMF(9)] | |
| iMF (2) iMF(5) iMF(8) | |
| iSD (3) iSD(6) iSD(9)] | |
| iSD (2) iSD(5) iSD(8) | |
| while (iEnd >1 &strList(iEnd)==delim) iEnd | |
| while (iStart< len &strList(iStart)==delim) iStart | |
| while (~strcmp(cs, '')) csU | |
Variables | |
| find where the assignment is | assgnLoc = strfind( st, ':=' ) |
| headerInfo | centerings = [{'?^} {'cell'} {'cell'} {'cell'}] |
| cs = pgetl(p) | |
| else let s see if we are dealing with a comment | csTmp = removeExcessDelimiters( cs, ' ' ) |
| assumed default space units for tenssor | data = '?^ |
| dataSize = prod(headerInfo.sizes) | |
| delimiterIndices = strfind(strList,' ') | |
| headerInfo | dimension = '?^ |
| dwiGradient = extractGradient( cs(length('DWMRI_GRADIENT_')+1:end ) ) | |
| headerInfo | encoding = '?^ |
| headerInfo | endian = '?^ |
| return function | fk |
| default | header |
| function | headerInfo |
| end | iEnd = len |
| for | iI |
| end | iLastWasDelimiter = 0 |
| iLocation = strfind( csU(length('SPACE:')+1:end ), 'RIGHT-ANTERIOR-SUPERIOR') | |
| end | indxList = [] |
| return function | iNrs |
| iSD = extractNumbersWithout( space_dir_tmp, {'(',')',','} ) | |
| iStart = 1 | |
| iThicknesses = [] | |
| keyWordU = upper( keyWord ) | |
| tensor has to have headerInfo | kinds |
| end return function | kvs |
| len = length( strList ) | |
| lenKeyword = length( keyWord ) | |
| lenThicknesses = length( sThicknesses ) | |
| end return helper functions from | marc |
| decided that the none is not needed in | matlab |
| headerInfo | measurementframe = [NaN NaN NaN |
| NaN NaN | NaN |
| numDelimiters = length(delimiterIndices) | |
| these fields are | optional |
| end Now read the data | popenType = nrrd2popenType( headerInfo.type ) |
| return | |
| headerInfo | sizes = '?^ |
| end return function | sl |
| headerInfo | space = '?^ |
| end but only of them are in space | space_dir_tmp = strrep( cs(length('SPACE DIRECTIONS:')+1:end), 'none', 'NaN' ) |
| headerInfo scalar data is expected to have values headerInfo | spacedirections = [NaN NaN NaN |
| headerInfo | spaceorigin = [NaN NaN NaN] |
| headerInfo | spaceunits = {'mm' 'mm' 'mm'} |
| headerInfo | thicknesses = iThicknesses |
| function | transformDT |
| headerInfo | type = '?^ |
| elseif | ( | foundKeyword('DWMRI_GRADIENT_', cs) | ) |
| elseif | ( | foundKeyword('DWMRI_B-VALUE', cs) | ) |
| elseif | ( | foundKeyword('MODALITY', cs) | ) |
| elseif | ( | foundKeyword('MEASUREMENT FRAME:', cs) | ) |
| elseif | ( | foundKeyword('SPACE ORIGIN:', cs) | ) |
| elseif | ( | foundKeyword('SPACE UNITS:', cs) | ) |
| elseif | ( | foundKeyword('CENTERINGS:', cs) | ) |
| elseif | ( | foundKeyword('KINDS:', cs) | ) |
| elseif | ( | foundKeyword('THICKNESSES:', cs) | ) |
| elseif | ( | foundKeyword('SIZES:', cs) | ) |
| end elseif | ( | foundKeyword('SPACE DIRECTIONS:', cs) | ) |
| elseif | ( | foundKeyword('SPACE:', cs) | ) |
| elseif | ( | foundKeyword('DIMENSION:', cs) | ) |
| elseif | ( | foundKeyword('ENCODING:', cs) | ) |
| elseif | ( | foundKeyword('ENDIAN:', cs) | ) |
| elseif | ( | foundKeyword('TYPE:', cs) | ) |
| function error | ( | ) |
Referenced by Cudapp::HostMemory::AllocateBytes(), Cudapp::DeviceMemory::AllocateBytes(), Cudapp::MemoryPitch::AllocatePitchBytes(), vtkSlicerParameterWidget::CreateWidgets(), endElement(), vtkPreciseHyperStreamline::Execute(), lmEndElement(), lmStartElement(), makeipaddr(), OpenGLBufferObject::Map(), vtkNeuroNavLogic::PerformPatientToImageRegistration(), vtkSlicerGPURayCastVolumeTextureMapper3D::PrintGLErrorString(), vtkSlicerGPURayCastVolumeMapper::PrintGLErrorString(), vtkSlicerGPURayCastMultiVolumeMapper::PrintGLErrorString(), qMRMLModelTest1(), qMRMLTransformProxyModelTest1(), vtkFSSurfaceAnnotationReader::ReadFSAnnotation(), ReadPGM(), OpenGLBufferObject::Register(), LoadableModuleFactory::ScanForSharedObjectModules(), setipaddr(), vtkSlicerModulesStep::SetStatus(), socket_getaddrinfo(), socket_getnameinfo(), startElement(), OpenGLBufferObject::Unmap(), and OpenGLBufferObject::Unregister().
| otherwise fprintf | ( | 'Unknown type:%s\n' | , | |
| headerInfo. | type | |||
| ) |
| else fprintf | ( | 'Warning:File is not | RAS, | |
| make sure subsequent matlab processing is consistent!\n' | ||||
| ) |
| headerInfo gradients | ( | iGNr+ | 1, | |
| : | ||||
| ) |
| return end if | ( | strcmp(csU(1:lenKeyword), keyWordU) | ) |
| if | ( | ) | [pure virtual] |
| else if | ( | ~ | iLastWasDelimiter | ) |
| if | ( | numDelimiters >= | 1 | ) |
References numDelimiters.
| if | ( | isempty(assgnLoc) | ) |
| if | ( | transformDT & | strcmpheaderInfo.kinds(1),'3D-masked-symmetric-matrix' | ) |
| return end if | ( | strcmp(headerInfo.kinds(1),'3D-masked-symmetric-matrix') | ) |
| end if | ( | strcmp(headerInfo.data,'') | = =1 |
) |
| only implemented for RAS if | ( | iLocation | , | |
| 0 | ||||
| ) |
| iMF | ( | 3 | ) |
| iMF | ( | 2 | ) |
| iSD | ( | 3 | ) |
| iSD | ( | 2 | ) |
| while | ( | iEnd | , | |
| 1 & | strListiEnd = =delim | |||
| ) |
| while | ( | ) |
| while | ( | ~ | strcmpcs, '' | ) |
| find where the assignment is assgnLoc = strfind( st, ':=' ) |
| headerInfo centerings = [{'?^} {'cell'} {'cell'} {'cell'}] |
Referenced by SlowFT2().
| headerInfo data = '?^ |
| dataSize = prod(headerInfo.sizes) |
| delimiterIndices = strfind(strList,' ') |
| headerInfo dimension = '?^ |
| else dwiGradient = extractGradient( cs(length('DWMRI_GRADIENT_')+1:end ) ) |
| headerInfo encoding = '?^ |
| headerInfo endian = '?^ |
| default header |
| end clear headerInfo |
preadNrrd( p, transformDT, original_measurementframe ) % read a nrrd image from a pipe opened by popenr % input: p pipe
| for iI |
1:lenThicknesses iThicknesses = [iThicknesses, str2num( sThicknesses{iI} ) ]
| end iLastWasDelimiter = 0 |
| end indxList = [] |
| end iNrs |
extractNumbersWithout( inputString, withoutTokens ) auxStr = inputString
| iSD = extractNumbersWithout( space_dir_tmp, {'(',')',','} ) |
| iStart = 1 |
| iThicknesses = [] |
| keyWordU = upper( keyWord ) |
[{'3D-masked-symmetric-matrix'}
% {'space'} {'space'} {'space'}]
| len = length( strList ) |
| lenKeyword = length( keyWord ) |
| lenThicknesses = length( sThicknesses ) |
| decided that the none is not needed in matlab |
| numDelimiters = length(delimiterIndices) |
| these fields are optional |
| end Now read the data popenType = nrrd2popenType( headerInfo.type ) |
| parse sizes headerInfo sizes = '?^ |
| end end sl |
extractStringList( strList ) strList = removeExcessDelimiters( strList, ' ' )
| headerInfo space = '?^ |
| decided that the none is not needed in it s nicer to have a matrix space_dir_tmp = strrep( cs(length('SPACE DIRECTIONS:')+1:end), 'none', 'NaN' ) |
| if (length(iSD)~=9 & length(iSD)~=10) fprintf('Warning end headerInfo spacedirections = [NaN NaN NaN |
| if (length(iSO)~=3) % fprintf('Warning end headerInfo spaceorigin = [NaN NaN NaN] |
| headerInfo spaceunits = {'mm' 'mm' 'mm'} |
| headerInfo type = '?^ |
1.6.1