You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(19) |
Nov
(45) |
Dec
(80) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(58) |
Feb
(127) |
Mar
(74) |
Apr
(34) |
May
(117) |
Jun
(14) |
Jul
(26) |
Aug
(13) |
Sep
(1) |
Oct
(38) |
Nov
(13) |
Dec
(5) |
| 2005 |
Jan
(108) |
Feb
(134) |
Mar
(54) |
Apr
(133) |
May
(16) |
Jun
(54) |
Jul
(128) |
Aug
(99) |
Sep
(157) |
Oct
(182) |
Nov
(236) |
Dec
(212) |
| 2006 |
Jan
(86) |
Feb
(76) |
Mar
(121) |
Apr
(27) |
May
(7) |
Jun
(1) |
Jul
(6) |
Aug
(28) |
Sep
(1) |
Oct
(27) |
Nov
(5) |
Dec
|
| 2007 |
Jan
(32) |
Feb
(22) |
Mar
(22) |
Apr
(11) |
May
(3) |
Jun
(12) |
Jul
(11) |
Aug
(9) |
Sep
(37) |
Oct
(4) |
Nov
(9) |
Dec
(51) |
| 2008 |
Jan
(7) |
Feb
(31) |
Mar
(46) |
Apr
(31) |
May
(5) |
Jun
(27) |
Jul
(12) |
Aug
(5) |
Sep
(13) |
Oct
(24) |
Nov
(112) |
Dec
(15) |
| 2009 |
Jan
(6) |
Feb
(103) |
Mar
(66) |
Apr
(9) |
May
(8) |
Jun
(1) |
Jul
(20) |
Aug
(9) |
Sep
(2) |
Oct
(81) |
Nov
(88) |
Dec
(30) |
| 2010 |
Jan
(65) |
Feb
(57) |
Mar
(22) |
Apr
(12) |
May
(4) |
Jun
(12) |
Jul
(43) |
Aug
(6) |
Sep
(6) |
Oct
(4) |
Nov
(6) |
Dec
(3) |
| 2011 |
Jan
(10) |
Feb
(27) |
Mar
(11) |
Apr
(9) |
May
(69) |
Jun
(73) |
Jul
(67) |
Aug
(116) |
Sep
(40) |
Oct
(11) |
Nov
(34) |
Dec
(19) |
| 2012 |
Jan
|
Feb
(4) |
Mar
(28) |
Apr
(18) |
May
(9) |
Jun
(7) |
Jul
(4) |
Aug
(155) |
Sep
(264) |
Oct
(172) |
Nov
(15) |
Dec
(40) |
| 2013 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
(20) |
Jul
(76) |
Aug
(67) |
Sep
(49) |
Oct
(27) |
Nov
(3) |
Dec
(3) |
| 2014 |
Jan
(7) |
Feb
(7) |
Mar
(16) |
Apr
|
May
(4) |
Jun
(1) |
Jul
(18) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
(6) |
Feb
(5) |
Mar
(3) |
Apr
(23) |
May
(5) |
Jun
|
Jul
(2) |
Aug
(4) |
Sep
|
Oct
|
Nov
(2) |
Dec
(4) |
| 2016 |
Jan
(2) |
Feb
(7) |
Mar
(2) |
Apr
(1) |
May
(14) |
Jun
(3) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
(3) |
| 2017 |
Jan
(6) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(12) |
Sep
(6) |
Oct
|
Nov
(3) |
Dec
|
| 2018 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2019 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(8) |
Oct
|
Nov
(2) |
Dec
(25) |
| 2020 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(53) |
Nov
(33) |
Dec
|
| 2021 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
(5) |
| 2022 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(93) |
Aug
(206) |
Sep
(39) |
Oct
(19) |
Nov
(11) |
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(150) |
Jul
(124) |
Aug
(14) |
Sep
(5) |
Oct
|
Nov
(1) |
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(62) |
Aug
|
Sep
(7) |
Oct
|
Nov
(7) |
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
(14) |
May
(3) |
Jun
|
Jul
|
Aug
(76) |
Sep
(214) |
Oct
(6) |
Nov
|
Dec
|
|
From: <kin...@us...> - 2024-09-06 08:00:31
|
Revision: 7236
http://sourceforge.net/p/teem/code/7236
Author: kindlmann
Date: 2024-09-06 08:00:29 +0000 (Fri, 06 Sep 2024)
Log Message:
-----------
unfortunately a mix of (1) new formatting with a new version of blue, and (2) changing how #defines in header files are processed: from a list of strings defined, to: a dict mapping from name to value, and a modest effort to apply those substitutions prior to sending things to cffi.cdef()
Modified Paths:
--------------
teem/trunk/python/cffi/exult.py
Modified: teem/trunk/python/cffi/exult.py
===================================================================
--- teem/trunk/python/cffi/exult.py 2024-09-05 20:51:26 UTC (rev 7235)
+++ teem/trunk/python/cffi/exult.py 2024-09-06 08:00:29 UTC (rev 7236)
@@ -113,7 +113,17 @@
},
'ten': {
'expr': False,
- 'deps': ['echo', 'limn', 'gage', 'dye', 'unrrdu', 'ell', 'nrrd', 'biff', 'air'],
+ 'deps': [
+ 'echo',
+ 'limn',
+ 'gage',
+ 'dye',
+ 'unrrdu',
+ 'ell',
+ 'nrrd',
+ 'biff',
+ 'air',
+ ],
},
'elf': {
'expr': True,
@@ -133,7 +143,16 @@
},
'mite': {
'expr': False,
- 'deps': ['ten', 'hoover', 'limn', 'gage', 'ell', 'nrrd', 'biff', 'air'],
+ 'deps': [
+ 'ten',
+ 'hoover',
+ 'limn',
+ 'gage',
+ 'ell',
+ 'nrrd',
+ 'biff',
+ 'air',
+ ],
},
'meet': {
'expr': False,
@@ -193,8 +212,8 @@
except Exception as exc:
raise RuntimeError(f'{lib} is not a known Teem library') from exc
# iteratively find all dependencies and dependencies of dependencies, etc
- oldd = set() # all previously dependencies known
- newd = set([lib]) | set(info['deps']) # newly discovered dependencies
+ oldd = set() # all previously dependencies known
+ newd = set([lib]) | set(info['deps']) # newly discovered dependencies
while oldd != newd:
# while new dependencies were just discovered
tmpd = set()
@@ -202,7 +221,7 @@
tmpd = tmpd | set([lib]) | set(_tlibs[nlb]['deps'])
oldd = newd
newd = tmpd
- tla = tlib_all() # linear array of all libs in dependency order
+ tla = tlib_all() # linear array of all libs in dependency order
# return dependencies sorted in dependency order
ret = sorted(list(newd), key=tla.index)
# exclude "experimental" libraries if not exper
@@ -320,10 +339,11 @@
"""
Given a header file, figures out which lines should be passed to ffi.cdef(), by first
excising comments, and it passing through a very dumb C pre-processor that interprets
- the #ifdef directives to figure out which lines are kept versus ignored.
+ the #ifdef directives to figure out which lines are kept versus ignored, and makes
+ cautious efforts to replace #define'd values in lines that are kept
"""
- def __init__(self, filename: str, defined: list[str], verb: int = 0):
+ def __init__(self, filename: str, defined: dict[str, str], verb: int = 0):
"""
Opens given file and sends it through "unu uncmt", and prepares to parse result
"""
@@ -363,8 +383,8 @@
"""
Do our best to scan input self.ilines to make output self.olines
"""
- for (lnum, linen) in enumerate(self.ilines):
- line = linen.strip() # strip left and right whitespace
+ for lnum, linen in enumerate(self.ilines):
+ line = linen.strip() # strip left and right whitespace
if not line:
continue
if self.verb > 1:
@@ -372,11 +392,11 @@
if line.startswith('#'):
# look for either #ifdef or #ifndef
if match := re.match(r'# *(ifn{0,1}def) +(\S.*)$', line):
- ifdef = 'ifdef' == match.group(1) # else its an ifndef
+ ifdef = 'ifdef' == match.group(1) # else its an ifndef
dname = match.group(2)
if self.verb > 1:
print(f'scan: -------- {match.group(1)} |{dname}|')
- if re.match(r'\S*\s', dname): # if there is whitespace in dname
+ if re.match(r'\S*\s', dname): # if there is whitespace in dname
raise Exception(
f'ScanHdr.scan({self.filename}): line {lnum} |{line}| has '
f'unexpected whitespace in {match.group(1)} argument |{dname}|'
@@ -408,11 +428,12 @@
self.ifstack.pop()
if self.verb > 1:
print(f'scan: -----> ifstack = {self.ifstack}')
- elif match := re.match(r'# *define +(\S+)(\s*\S*)$', line):
+ elif match := re.match(r'# *define +(\S+) +(\S.+)$', line):
+ # elif match := re.match(r"# *define +(\S+)(\s*\S*)$", line):
dname = match.group(1)
dval = match.group(2)
if all(self.ifstack):
- self.defined.append(dname)
+ self.defined[dname] = dval
if self.verb > 1:
print(f'scan: |{dname}|=|{dval}| -------> defined = {self.defined}')
elif re.match(r'# *include', line):
@@ -435,6 +456,23 @@
print(f'scan: -------- DROPPING |{line}|')
continue
# Else we keep the line, and do further processing.
+ # Try to apply #define substitutions
+ for dfn, val in self.defined.items():
+ if not val or not dfn.isupper():
+ # dfn is merely #define'd, but not to anything, or else dfn's letters
+ # are not all upper-case (which is the strong convention for #define's)
+ continue
+ if not '_' in dfn or not len(dfn) > 6:
+ # #define'd name does not contain a '_', or else it is too short, so we
+ # don't consider it more. Seem like an arbitrary limitation, but this is
+ # consistent with the ways that Teem and Teem-adjacent headers #define things.
+ continue
+ # see if dfn appears in line
+ if dfn in line:
+ newline = line.replace(dfn, val)
+ if self.verb > 2:
+ print(f' |{line}| --{dfn}:{val}--> |{newline}|')
+ line = newline
# The parentheses matching of this re is quite fragile
if match := re.match(r'(__attribute__\(.*\))', line):
rpl = line.replace(match.group(1), '')
@@ -494,20 +532,23 @@
f'Missing directory with per-Teem-library biff .csv files {self.path_biffdata}'
)
# This does a lot of error checking
- (self.path_thdr, self.path_tlib, self.have_tlibs, self.exper) = check_path_tinst(
- path_tinst
- )
+ (
+ self.path_thdr,
+ self.path_tlib,
+ self.have_tlibs,
+ self.exper,
+ ) = check_path_tinst(path_tinst)
self.path_tinst = path_tinst
# initialize other members; these will be updated if self.desc() is called to describe
# another library (that depends on Teem) for which we're here to make an extension
# module. The "n" in path_nhdr and path_nlib is for that *N*on-Teem library
- self.path_nhdr = '' # path to header file name.h (nothing to do with .nhdr files!)
- self.path_nlib = '' # path to library file libname.{so,dylib}
- self.libs = ['teem'] # name(s) of libraries the extension module depends on
- self.path_libs = [self.path_tlib] # absolute paths to libraries we depend on
- self.dfnd = [] # things nominally #define'd for sake of cdef()
- self.eca = [] # extra compile args
- self.ela = [] # extra link args
+ self.path_nhdr = '' # path to header file name.h (nothing to do with .nhdr files!)
+ self.path_nlib = '' # path to library file libname.{so,dylib}
+ self.libs = ['teem'] # name(s) of libraries the extension module depends on
+ self.path_libs = [self.path_tlib] # absolute paths to libraries we depend on
+ self.dfnd = {} # things #define'd for sake of header processing for cdef()
+ self.eca = [] # extra compile args
+ self.ela = [] # extra link args
self.source_args = None
self.lib_out = None
if 'teem' == top_tlib:
@@ -528,7 +569,7 @@
self.exper = tlib_experimental(top_tlib)
# create the instance, but don't do anything with it; that depends on other methods
self.ffi = cffi.FFI()
- self.step = 1 # for tracking correct ordering of method calls
+ self.step = 1 # for tracking correct ordering of method calls
def desc(
self,
@@ -535,7 +576,7 @@
name: str,
path_nhdr: str,
path_nlib: str,
- dfnd: list[str],
+ dfnd: dict[str, str],
eca: list[str],
ela: list[str],
):
@@ -545,7 +586,7 @@
:param str name: name of the new non-Teem library
:param str path_nhdr: path to headers for your library, to give to -I when compiling
:param str path_nlib: path to your compile library, to give to -L when compiling
- :param list[str] dfnd: things that should be considered #define'd for ffi.cdef()
+ :param dict[str, str] dfnd: #define's to pass on to ffi.cdef()
:param list[str] eca: for the extra_compile_args parameter to ffi.compile()
:param list[str] ela: for the extra_link_args parameter to ffi.compile()
"""
@@ -567,7 +608,7 @@
raise Exception(f'Need path_nhdr {path_nhdr} to be a directory')
if not os.path.isdir(path_nlib):
raise Exception(f'Need path_nlib {path_nlib} to be a directory')
- self.libs.insert(0, name) # now [name, 'teem']
+ self.libs.insert(0, name) # now [name, 'teem']
self.name = name
self.path_nhdr = os.path.abspath(path_nhdr)
self.path_nlib = os.path.abspath(path_nlib)
@@ -584,7 +625,7 @@
"""
if 1 != self.step:
raise Exception('Expected .cdef() only right after Tffi creation and optional .desc()')
- # want free() available in for freeing biff messages
+ # want free() available for freeing biff messages
self.ffi.cdef('extern void free(void *);')
# read in the relevant Teem cdef/ headers
for lib in tlib_depends(self.top_tlib, self.exper):
@@ -624,7 +665,7 @@
),
# The next arg teaches the extension library about the paths that the dynamic linker
# should look in for other libraries we depend on (the dynamic linker does not know
- # or care about $TEEM_INSTALL). We avoid any reliace on environment variables like
+ # or care about $TEEM_INSTALL). We avoid any reliance on environment variables like
# LD_LIBRARY_PATH on linux or DYLD_LIBRARY_PATH on Mac (on recent Macs the System
# Integrity Protection (SIP) actually disables DYLD_LIBRARY_PATH).
# On linux, paths listed here are passed to -Wl,--enable-new-dtags,-R<dir>
@@ -641,7 +682,7 @@
# https://docs.python.org/3/distutils/apiref.html#distutils.core.Extension
'undef_macros': ['NDEBUG'],
}
- arg1 = f'_{self.name}' # HERE is where we add the leading underscore
+ arg1 = f'_{self.name}' # HERE is where we add the leading underscore
arg2 = f'#include <teem/{self.top_tlib}.h>' + (
'' if self.isteem else f'\n#include <{self.name}.h>'
)
@@ -678,7 +719,7 @@
# We exploit the correspondance between elements of self.libs and self.path_libs
# and HEY that suggests that there should some higher-level object that contains
# all the properties of a library
- for (lidx, lname) in enumerate(self.libs):
+ for lidx, lname in enumerate(self.libs):
cmd = (
f'install_name_tool -change @rpath/lib{lname}.dylib '
f'{self.path_libs[lidx]}/lib{lname}.dylib {self.lib_out}'
@@ -733,13 +774,13 @@
"""
# most common case: return of 1 means there's a biff error
if errval_t.endswith('int') and '1' == errval:
- ret = '_equals_one' # this is defined in lliibb.py
+ ret = '_equals_one' # this is defined in lliibb.py
elif errval_t.endswith('*') and 'NULL' == errval:
- ret = '_equals_null' # this is defined in lliibb.py
+ ret = '_equals_null' # this is defined in lliibb.py
elif 'AIR_NAN' == errval or 'nan' == errval.lower():
ret = '_math.isnan'
else:
- evlist = errval.split('|') # list (likely length-1) of error-indicating return values
+ evlist = errval.split('|') # list (likely length-1) of error-indicating return values
ret = (
'(lambda rv: ' # we make (a string representing) a lambda function
# join, with "or", test expressions for everything in evlist
@@ -758,7 +799,7 @@
"""
if not self.step in (1, 4):
raise Exception('Expected .wrap() only after creation, .desc(), or .compile()')
- biffdatas = [] # a list of rows from .csv files
+ biffdatas = [] # a list of rows from .csv files
for lib in tlib_depends(self.top_tlib, self.exper):
path_bdata = self.path_biffdata + f'/{lib}.csv'
if not os.path.isfile(path_bdata):
@@ -786,7 +827,7 @@
raise Exception("Didn't see wrapper template at {path_lliibb}")
with open(path_lliibb, 'r', encoding='utf-8') as file:
ilines = [line.rstrip() for line in file.readlines()]
- for (lidx, line) in enumerate(ilines):
+ for lidx, line in enumerate(ilines):
# first pass of very simple text transformations we do
# 'lliibb' --> self.name
# 'LLIIBB' --> 'lliibb'
@@ -801,7 +842,7 @@
# bdl[ 0 1 2 3 4 5 ]
# f'{function},{qualtype},{errval},{mubi},{biffkey},{fnln}'
# ---> (rvtf, mubi, bkey, fnln) = _BIFF_DICT[sym_name]
- for bdl in sum(biffdatas, []): # flattening into big list of csv rows
+ for bdl in sum(biffdatas, []): # flattening into big list of csv rows
rvtf = self._rvt_func(bdl[0], bdl[1], bdl[2])
file.write(
f" '{bdl[0]}': ({rvtf}, {bdl[3]}, b'{bdl[4]}', '{bdl[5]}'),\n"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-09-05 20:51:27
|
Revision: 7235
http://sourceforge.net/p/teem/code/7235
Author: kindlmann
Date: 2024-09-05 20:51:26 +0000 (Thu, 05 Sep 2024)
Log Message:
-----------
syncing with sources
Modified Paths:
--------------
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2024-07-25 00:36:16 UTC (rev 7234)
+++ teem/trunk/python/cffi/teem.py 2024-09-05 20:51:26 UTC (rev 7235)
@@ -293,14 +293,6 @@
'mossSamplerSample': (_equals_one, 0, b'moss', 'moss/sampler.c:195'),
'mossLinearTransform': (_equals_one, 0, b'moss', 'moss/xform.c:140'),
'mossFourPointTransform': (_equals_one, 0, b'moss', 'moss/xform.c:219'),
- 'alanUpdate': (_equals_one, 0, b'alan', 'alan/coreAlan.c:60'),
- 'alanInit': (_equals_one, 0, b'alan', 'alan/coreAlan.c:99'),
- 'alanRun': (_equals_one, 0, b'alan', 'alan/coreAlan.c:453'),
- 'alanDimensionSet': (_equals_one, 0, b'alan', 'alan/methodsAlan.c:104'),
- 'alan2DSizeSet': (_equals_one, 0, b'alan', 'alan/methodsAlan.c:119'),
- 'alan3DSizeSet': (_equals_one, 0, b'alan', 'alan/methodsAlan.c:139'),
- 'alanTensorSet': (_equals_one, 0, b'alan', 'alan/methodsAlan.c:161'),
- 'alanParmSet': (_equals_one, 0, b'alan', 'alan/methodsAlan.c:208'),
'gageContextCopy': (_equals_null, 0, b'gage', 'gage/ctx.c:88'),
'gageKernelSet': (_equals_one, 0, b'gage', 'gage/ctx.c:199'),
'gagePerVolumeAttach': (_equals_one, 0, b'gage', 'gage/ctx.c:398'),
@@ -347,31 +339,6 @@
'gageOptimSigErrorPlotSliding': (_equals_one, 0, b'gage', 'gage/optimsig.c:1253'),
'dyeConvert': (_equals_one, 0, b'dye', 'dye/convertDye.c:351'),
'dyeColorParse': (_equals_one, 0, b'dye', 'dye/methodsDye.c:185'),
- 'baneClipNew': (_equals_null, 0, b'bane', 'bane/clip.c:102'),
- 'baneClipAnswer': (_equals_one, 0, b'bane', 'bane/clip.c:152'),
- 'baneClipCopy': (_equals_null, 0, b'bane', 'bane/clip.c:167'),
- 'baneFindInclusion': (_equals_one, 0, b'bane', 'bane/hvol.c:87'),
- 'baneMakeHVol': (_equals_one, 0, b'bane', 'bane/hvol.c:248'),
- 'baneGKMSHVol': (_equals_null, 0, b'bane', 'bane/hvol.c:447'),
- 'baneIncNew': (_equals_null, 0, b'bane', 'bane/inc.c:251'),
- 'baneIncAnswer': (_equals_one, 0, b'bane', 'bane/inc.c:360'),
- 'baneIncCopy': (_equals_null, 0, b'bane', 'bane/inc.c:375'),
- 'baneMeasrNew': (_equals_null, 0, b'bane', 'bane/measr.c:33'),
- 'baneMeasrCopy': (_equals_null, 0, b'bane', 'bane/measr.c:149'),
- 'baneRangeNew': (_equals_null, 0, b'bane', 'bane/rangeBane.c:89'),
- 'baneRangeCopy': (_equals_null, 0, b'bane', 'bane/rangeBane.c:130'),
- 'baneRangeAnswer': (_equals_one, 0, b'bane', 'bane/rangeBane.c:144'),
- 'baneRawScatterplots': (_equals_one, 0, b'bane', 'bane/scat.c:26'),
- 'baneOpacInfo': (_equals_one, 0, b'bane', 'bane/trnsf.c:29'),
- 'bane1DOpacInfoFrom2D': (_equals_one, 0, b'bane', 'bane/trnsf.c:144'),
- 'baneSigmaCalc': (_equals_one, 0, b'bane', 'bane/trnsf.c:222'),
- 'banePosCalc': (_equals_one, 0, b'bane', 'bane/trnsf.c:253'),
- 'baneOpacCalc': (_equals_one, 0, b'bane', 'bane/trnsf.c:403'),
- 'baneInputCheck': (_equals_one, 0, b'bane', 'bane/valid.c:26'),
- 'baneHVolCheck': (_equals_one, 0, b'bane', 'bane/valid.c:64'),
- 'baneInfoCheck': (_equals_one, 0, b'bane', 'bane/valid.c:106'),
- 'banePosCheck': (_equals_one, 0, b'bane', 'bane/valid.c:144'),
- 'baneBcptsCheck': (_equals_one, 0, b'bane', 'bane/valid.c:179'),
'limnCameraUpdate': (_equals_one, 0, b'limn', 'limn/cam.c:33'),
'limnCameraAspectSet': (_equals_one, 0, b'limn', 'limn/cam.c:130'),
'limnCameraPathMake': (_equals_one, 0, b'limn', 'limn/cam.c:189'),
@@ -615,21 +582,6 @@
'pullTraceMultiPlotAdd': (_equals_one, 0, b'pull', 'pull/trace.c:704'),
'pullTraceMultiWrite': (_equals_one, 0, b'pull', 'pull/trace.c:1014'),
'pullTraceMultiRead': (_equals_one, 0, b'pull', 'pull/trace.c:1119'),
- 'coilStart': (_equals_one, 0, b'coil', 'coil/coreCoil.c:287'),
- 'coilIterate': (_equals_one, 0, b'coil', 'coil/coreCoil.c:362'),
- 'coilFinish': (_equals_one, 0, b'coil', 'coil/coreCoil.c:407'),
- 'coilVolumeCheck': (_equals_one, 0, b'coil', 'coil/methodsCoil.c:25'),
- 'coilContextAllSet': (_equals_one, 0, b'coil', 'coil/methodsCoil.c:69'),
- 'coilOutputGet': (_equals_one, 0, b'coil', 'coil/methodsCoil.c:200'),
- 'pushOutputGet': (_equals_one, 0, b'push', 'push/action.c:71'),
- 'pushBinProcess': (_equals_one, 0, b'push', 'push/action.c:161'),
- 'pushBinPointAdd': (_equals_one, 0, b'push', 'push/binning.c:180'),
- 'pushRebin': (_equals_one, 0, b'push', 'push/binning.c:197'),
- 'pushStart': (_equals_one, 0, b'push', 'push/corePush.c:183'),
- 'pushIterate': (_equals_one, 0, b'push', 'push/corePush.c:233'),
- 'pushRun': (_equals_one, 0, b'push', 'push/corePush.c:306'),
- 'pushFinish': (_equals_one, 0, b'push', 'push/corePush.c:396'),
- 'pushEnergySpecParse': (_equals_one, 0, b'push', 'push/forces.c:304'),
'miteSample': (_math.isnan, 0, b'mite', 'mite/ray.c:151'),
'miteRenderBegin': (_equals_one, 0, b'mite', 'mite/renderMite.c:63'),
'miteShadeSpecParse': (_equals_one, 0, b'mite', 'mite/shade.c:69'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-25 00:36:19
|
Revision: 7234
http://sourceforge.net/p/teem/code/7234
Author: kindlmann
Date: 2024-07-25 00:36:16 +0000 (Thu, 25 Jul 2024)
Log Message:
-----------
syncing with sources
Modified Paths:
--------------
teem/trunk/python/cffi/biffdata/limn.csv
teem/trunk/python/cffi/cdef/cdef_limn.h
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/biffdata/limn.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/limn.csv 2024-07-25 00:34:44 UTC (rev 7233)
+++ teem/trunk/python/cffi/biffdata/limn.csv 2024-07-25 00:36:16 UTC (rev 7234)
@@ -64,10 +64,10 @@
limnCbfPointsCheck,int,1,0,limn,limn/splineFit.c:249
limnCbfCtxPrep,int,1,0,limn,limn/splineFit.c:520
limnCbfTVT,int,1,0,limn,limn/splineFit.c:788
-limnCbfSingle,int,1,0,limn,limn/splineFit.c:1517
-limnCbfCorners,int,1,0,limn,limn/splineFit.c:1568
-limnCbfMulti,int,1,0,limn,limn/splineFit.c:1770
-limnCbfGo,int,1,0,limn,limn/splineFit.c:1888
+limnCbfSingle,int,1,0,limn,limn/splineFit.c:1528
+limnCbfCorners,int,1,0,limn,limn/splineFit.c:1579
+limnCbfMulti,int,1,0,limn,limn/splineFit.c:1781
+limnCbfGo,int,1,0,limn,limn/splineFit.c:1899
limnObjectWorldHomog,int,1,0,limn,limn/transform.c:25
limnObjectFaceNormals,int,1,0,limn,limn/transform.c:47
limnObjectSpaceTransform,int,1,0,limn,limn/transform.c:210
Modified: teem/trunk/python/cffi/cdef/cdef_limn.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_limn.h 2024-07-25 00:34:44 UTC (rev 7233)
+++ teem/trunk/python/cffi/cdef/cdef_limn.h 2024-07-25 00:36:16 UTC (rev 7234)
@@ -495,11 +495,11 @@
continuous between multiple spline segments) */
cornerNMS; /* (if cornerFind) non-minimal-suppression of corners: accept as
corners only those with locally minimal angle */
- int (*cornerCB)(double *tvtNew, /* if corner, set new TVT */
+ int (*cornerCB)(double *tvtNew, /* if corner (non-zero return), set new TVT */
const struct limnCbfCtx_t *fctx, /* this struct */
- double angleMeas, /* measured angle */
- const double *tvtMeas, /* measured TVT */
- const double *vertOrig); /* original vertex pos */
+ double angleMeas, /* angle measured at fctx->scale */
+ const double *tvtMeas, /* TVT measured at fctx->scale */
+ const double *tvt0); /* TVT at scale=0 */
const void *cornerCBData; /* holds extra info for cornerCB */
unsigned int nrpIterMax; /* max # iters of nrp */
double
@@ -851,7 +851,7 @@
extern void limnCbfSegEval(double *xy, const limnCbfSeg *seg, double tt);
extern void limnCbfPathSample(double *xy, unsigned int pointNum,
const limnCbfPath *path);
-extern int limnCbfTVT(double lt[2], double vv[2], double rt[2],
+extern int limnCbfTVT(double lt[2], double vv[2], double rt[2], double *tvt0,
const limnCbfCtx *fctx, const limnCbfPoints *lpnt,
unsigned int loi, unsigned int hii, unsigned int vvi,
int oneSided);
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2024-07-25 00:34:44 UTC (rev 7233)
+++ teem/trunk/python/cffi/teem.py 2024-07-25 00:36:16 UTC (rev 7234)
@@ -437,10 +437,10 @@
'limnCbfPointsCheck': (_equals_one, 0, b'limn', 'limn/splineFit.c:249'),
'limnCbfCtxPrep': (_equals_one, 0, b'limn', 'limn/splineFit.c:520'),
'limnCbfTVT': (_equals_one, 0, b'limn', 'limn/splineFit.c:788'),
- 'limnCbfSingle': (_equals_one, 0, b'limn', 'limn/splineFit.c:1517'),
- 'limnCbfCorners': (_equals_one, 0, b'limn', 'limn/splineFit.c:1568'),
- 'limnCbfMulti': (_equals_one, 0, b'limn', 'limn/splineFit.c:1770'),
- 'limnCbfGo': (_equals_one, 0, b'limn', 'limn/splineFit.c:1888'),
+ 'limnCbfSingle': (_equals_one, 0, b'limn', 'limn/splineFit.c:1528'),
+ 'limnCbfCorners': (_equals_one, 0, b'limn', 'limn/splineFit.c:1579'),
+ 'limnCbfMulti': (_equals_one, 0, b'limn', 'limn/splineFit.c:1781'),
+ 'limnCbfGo': (_equals_one, 0, b'limn', 'limn/splineFit.c:1899'),
'limnObjectWorldHomog': (_equals_one, 0, b'limn', 'limn/transform.c:25'),
'limnObjectFaceNormals': (_equals_one, 0, b'limn', 'limn/transform.c:47'),
'limnObjectSpaceTransform': (_equals_one, 0, b'limn', 'limn/transform.c:210'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-25 00:34:46
|
Revision: 7233
http://sourceforge.net/p/teem/code/7233
Author: kindlmann
Date: 2024-07-25 00:34:44 +0000 (Thu, 25 Jul 2024)
Log Message:
-----------
limnCbfTVT now computes scale=0 TVT, and that is now passed back to fctx->cornerCB corner tester
Modified Paths:
--------------
teem/trunk/src/limn/limn.h
teem/trunk/src/limn/lpu_cbfit.c
teem/trunk/src/limn/splineFit.c
Modified: teem/trunk/src/limn/limn.h
===================================================================
--- teem/trunk/src/limn/limn.h 2024-07-24 23:36:11 UTC (rev 7232)
+++ teem/trunk/src/limn/limn.h 2024-07-25 00:34:44 UTC (rev 7233)
@@ -560,11 +560,11 @@
continuous between multiple spline segments) */
cornerNMS; /* (if cornerFind) non-minimal-suppression of corners: accept as
corners only those with locally minimal angle */
- int (*cornerCB)(double *tvtNew, /* if corner, set new TVT */
+ int (*cornerCB)(double *tvtNew, /* if corner (non-zero return), set new TVT */
const struct limnCbfCtx_t *fctx, /* this struct */
- double angleMeas, /* measured angle */
- const double *tvtMeas, /* measured TVT */
- const double *vertOrig); /* original vertex pos */
+ double angleMeas, /* angle measured at fctx->scale */
+ const double *tvtMeas, /* TVT measured at fctx->scale */
+ const double *tvt0); /* TVT at scale=0 */
const void *cornerCBData; /* holds extra info for cornerCB */
unsigned int nrpIterMax; /* max # iters of nrp */
double
@@ -937,7 +937,7 @@
LIMN_EXPORT void limnCbfSegEval(double *xy, const limnCbfSeg *seg, double tt);
LIMN_EXPORT void limnCbfPathSample(double *xy, unsigned int pointNum,
const limnCbfPath *path);
-LIMN_EXPORT int limnCbfTVT(double lt[2], double vv[2], double rt[2],
+LIMN_EXPORT int limnCbfTVT(double lt[2], double vv[2], double rt[2], double *tvt0,
const limnCbfCtx *fctx, const limnCbfPoints *lpnt,
unsigned int loi, unsigned int hii, unsigned int vvi,
int oneSided);
Modified: teem/trunk/src/limn/lpu_cbfit.c
===================================================================
--- teem/trunk/src/limn/lpu_cbfit.c 2024-07-24 23:36:11 UTC (rev 7232)
+++ teem/trunk/src/limn/lpu_cbfit.c 2024-07-25 00:34:44 UTC (rev 7233)
@@ -352,7 +352,7 @@
tvt[2], tvt[0], tvt[1], vvi, loi, hii);
if (!E) E |= limnCbfCtxPrep(fctx, lpnt);
if (!E && fctx->verbose) printf("%s: limnCbfCtxPrep done, calling limnCbfTVT\n", me);
- if (!E) E |= limnCbfTVT(lt, vv, rt, fctx, lpnt, loi, hii, vvi, oneSided);
+ if (!E) E |= limnCbfTVT(lt, vv, rt, NULL, fctx, lpnt, loi, hii, vvi, oneSided);
if (E) {
airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble doing lone tangent-vertex-tangent:\n%s", me, err);
Modified: teem/trunk/src/limn/splineFit.c
===================================================================
--- teem/trunk/src/limn/splineFit.c 2024-07-24 23:36:11 UTC (rev 7232)
+++ teem/trunk/src/limn/splineFit.c 2024-07-25 00:34:44 UTC (rev 7233)
@@ -785,8 +785,9 @@
That (via ctxBuffersSet) allocates things that we depend on here.
*/
int /* Biff: 1 */
-limnCbfTVT(double lt[2], double vv[2], double rt[2], const limnCbfCtx *fctx,
- const limnCbfPoints *lpnt, uint gloi, uint ghii, uint gvvi, int oneSided) {
+limnCbfTVT(double lt[2], double vv[2], double rt[2], double *tvt0,
+ const limnCbfCtx *fctx, const limnCbfPoints *lpnt, uint gloi, uint ghii,
+ uint gvvi, int oneSided) {
static const char me[] = "limnCbfTVT";
uint loi, /* error-checked gloi */
hii, /* error-checked ghii, lifted if needed */
@@ -795,6 +796,9 @@
simplifies implementing arithmetic and comparisons given how indices wrap around in
point loops */
int slo, shi, svi; /* signed versions of loi, hii, vvi */
+ int iplus, imnus; /* for scale=0 discrete differences */
+ const double *xyC, *xyP, *xyM;
+ double rt0[2], lt0[2];
if (!((lt || vv || rt) && fctx && lpnt)) {
biffAddf(LIMN, "%s: got NULL pointer (or too many NULL pointers)", me);
@@ -824,30 +828,37 @@
slo = AIR_INT(loi);
shi = AIR_INT(hii);
svi = AIR_INT(vvi);
+ /* DIM=2 through-out */
+ iplus = svi + 1;
+ imnus = svi - 1;
+ if (slo < shi) { /* bounded */
+ iplus = AIR_CLAMP(slo, iplus, shi);
+ imnus = AIR_CLAMP(slo, imnus, shi);
+ }
+ xyM = PPlowerI(lpnt, imnus);
+ xyC = PPlowerI(lpnt, svi);
+ xyP = PPlowerI(lpnt, iplus);
+ subnorm2(lt0, xyM, oneSided ? xyC : xyP);
+ subnorm2(rt0, xyP, oneSided ? xyC : xyM);
+ if (tvt0) {
+ ELL_2V_COPY(tvt0 + 0, lt0);
+ ELL_2V_COPY(tvt0 + 2, xyC);
+ ELL_2V_COPY(tvt0 + 4, rt0);
+ }
if (0 == fctx->scale) {
- /* DIM=2 through-out */
- const double *xyC, *xyP, *xyM;
- int iplus = svi + 1, imnus = svi - 1;
- if (slo < shi) { /* bounded */
- iplus = AIR_CLAMP(slo, iplus, shi);
- imnus = AIR_CLAMP(slo, imnus, shi);
- }
- xyM = PPlowerI(lpnt, imnus);
- xyC = PPlowerI(lpnt, svi);
- xyP = PPlowerI(lpnt, iplus);
if (fctx->verbose > 1) {
- printf("%s: %d | %d | %d --> (%g,%g)|(%g,%g)|(%g,%g)\n", me, imnus, svi, iplus,
- xyM[0], xyM[1], xyC[0], xyC[1], xyP[0], xyP[1]);
+ printf("%s: (-) %d | %d | (+) %d --> (%g,%g)|(%g,%g)|(%g,%g)\n", me, imnus, svi,
+ iplus, xyM[0], xyM[1], xyC[0], xyC[1], xyP[0], xyP[1]);
}
+ if (lt) {
+ ELL_2V_COPY(lt, lt0);
+ }
if (vv) {
ELL_2V_COPY(vv, xyC);
}
if (rt) {
- subnorm2(rt, xyP, oneSided ? xyC : xyM);
+ ELL_2V_COPY(rt, rt0);
}
- if (lt) {
- subnorm2(lt, xyM, oneSided ? xyC : xyP);
- }
} else {
/* using scale>0 for endpoint and tangent estimation */
/* for simplicity: regardless of dir, we compute average positions for points
@@ -1209,7 +1220,7 @@
CBD1(splTan, vv0, vv1, vv2, vv3, um, ww);
ELL_2V_NORM(splTan, splTan, tmp);
/* we emulate how tangent estimation would happen if had decided to split at midi */
- if (limnCbfTVT(NULL, NULL, midTan, fctx, lpnt, loi, hii, midi,
+ if (limnCbfTVT(NULL, NULL, midTan, NULL, fctx, lpnt, loi, hii, midi,
AIR_FALSE /* NOT oneSided */)) {
biffAddf(LIMN, "%s: trying to get middle tangent at %u in [%u,%u]", me, midi, loi,
hii);
@@ -1457,7 +1468,7 @@
biffAddf(LIMN, "%s: can handle loi=hii only with point loop", me);
return 1;
}
- if (limnCbfTVT(t2c, v0c, t1c, /* */
+ if (limnCbfTVT(t2c, v0c, t1c, NULL, /* */
fctx, lpnt, loi, hii, loi, /* */
AIR_FALSE /* NOT oneSided */)) {
biffAddf(LIMN, "%s: trouble finding two-sided geometry info", me);
@@ -1466,10 +1477,10 @@
ELL_2V_COPY(v3c, v0c);
} else {
/* loi < hii */
- if (limnCbfTVT(NULL, v0c, t1c, /* */
+ if (limnCbfTVT(NULL, v0c, t1c, NULL, /* */
fctx, lpnt, loi, hii, loi, /* */
AIR_TRUE /* yes oneSided */)
- || limnCbfTVT(t2c, v3c, NULL, /* */
+ || limnCbfTVT(t2c, v3c, NULL, NULL, /* */
fctx, lpnt, loi, hii, hii, /* */
AIR_TRUE /* yes oneSided */)) {
biffAddf(LIMN, "%s: trouble finding one-sided geometry info", me);
@@ -1598,9 +1609,9 @@
return 1;
}
hii = pnum - 1;
- if (limnCbfTVT(fctx->ctvt + 0, fctx->ctvt + 2, fctx->ctvt + 4, /* */
+ if (limnCbfTVT(fctx->ctvt + 0, fctx->ctvt + 2, fctx->ctvt + 4, NULL, /* */
fctx, lpnt, 0, hii, 0, AIR_TRUE /* yes oneSided */)
- || limnCbfTVT(fctx->ctvt + 6, fctx->ctvt + 8, fctx->ctvt + 10, /* */
+ || limnCbfTVT(fctx->ctvt + 6, fctx->ctvt + 8, fctx->ctvt + 10, NULL, /* */
fctx, lpnt, 0, hii, hii, AIR_TRUE /* yes oneSided */)) {
biffAddf(LIMN, "%s: trouble with tangents or vertices for endpoints", me);
return 1;
@@ -1640,6 +1651,7 @@
double *LT = vtvt + 0 + 6 * vi;
double *VV = vtvt + 2 + 6 * vi;
double *RT = vtvt + 4 + 6 * vi;
+ double tvt0[6];
/* we find TVT for *every* vertex, despite this seeming like computational overkill.
Why: we don't know which vertex might be corner until we look at the
tangent-to-tangent angles for EVERY vertex, for which we don't need to know the
@@ -1648,7 +1660,7 @@
revisit the input data (used previously for tangent estimation) to figure out the
corner vertices. In a non-loop, we know first and last points will be corners, but we
still need to find the vertex pos and (one-sided) tangent. */
- if (limnCbfTVT(LT, VV, RT, fctx, lpnt, 0 /* loi */, 0 /* hii */, vi,
+ if (limnCbfTVT(LT, VV, RT, tvt0, fctx, lpnt, 0 /* loi */, 0 /* hii */, vi,
AIR_TRUE /* yes oneSided */)) {
biffAddf(LIMN, "%s: trouble with tangents or vertices for point %u/%u", me, vi,
pnum);
@@ -1665,8 +1677,7 @@
angle[vi] = 180 * ell_2v_angle_d(LT, RT) / AIR_PI;
if (fctx->cornerCB) {
double tvtNew[6];
- if (fctx->cornerCB(tvtNew, fctx, angle[vi], vtvt + 0 + 6 * vi,
- PPlowerI(lpnt, vi))) {
+ if (fctx->cornerCB(tvtNew, fctx, angle[vi], vtvt + 0 + 6 * vi, tvt0)) {
corny[vi] = AIR_TRUE;
ELL_6V_COPY(vtvt + 0 + 6 * vi, tvtNew);
} else {
@@ -1838,7 +1849,7 @@
recDepth, fctx->distMax, fctx->distBig, midi, (pp + 2 * midi)[0],
(pp + 2 * midi)[1]);
}
- if (limnCbfTVT(TL, VM, TR, /* */
+ if (limnCbfTVT(TL, VM, TR, NULL, /* */
fctx, lpnt, loi, hii, midi, /* */
AIR_FALSE /* NOT oneSided */)
|| limnCbfMulti(path, V0, T1, TL, VM, recDepth + 1, &fctxL, lpnt, loi, midi)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-24 23:36:17
|
Revision: 7232
http://sourceforge.net/p/teem/code/7232
Author: kindlmann
Date: 2024-07-24 23:36:11 +0000 (Wed, 24 Jul 2024)
Log Message:
-----------
syncing with source
Modified Paths:
--------------
teem/trunk/python/cffi/biffdata/limn.csv
teem/trunk/python/cffi/cdef/cdef_limn.h
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/biffdata/limn.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/limn.csv 2024-07-24 23:33:49 UTC (rev 7231)
+++ teem/trunk/python/cffi/biffdata/limn.csv 2024-07-24 23:36:11 UTC (rev 7232)
@@ -60,14 +60,14 @@
limnSplineUpdate,int,1,0,limn,limn/splineMethods.c:422
limnSplineTypeSpecParse,limnSplineTypeSpec *,NULL,0,limn,limn/splineMisc.c:222
limnSplineParse,limnSpline *,NULL,0,limn,limn/splineMisc.c:278
-limnCbfPointsNew,limnCbfPoints *,NULL,0,limn,limn/splineFit.c:175
-limnCbfPointsCheck,int,1,0,limn,limn/splineFit.c:247
-limnCbfCtxPrep,int,1,0,limn,limn/splineFit.c:516
-limnCbfTVT,int,1,0,limn,limn/splineFit.c:784
-limnCbfSingle,int,1,0,limn,limn/splineFit.c:1513
-limnCbfCorners,int,1,0,limn,limn/splineFit.c:1564
-limnCbfMulti,int,1,0,limn,limn/splineFit.c:1747
-limnCbfGo,int,1,0,limn,limn/splineFit.c:1865
+limnCbfPointsNew,limnCbfPoints *,NULL,0,limn,limn/splineFit.c:177
+limnCbfPointsCheck,int,1,0,limn,limn/splineFit.c:249
+limnCbfCtxPrep,int,1,0,limn,limn/splineFit.c:520
+limnCbfTVT,int,1,0,limn,limn/splineFit.c:788
+limnCbfSingle,int,1,0,limn,limn/splineFit.c:1517
+limnCbfCorners,int,1,0,limn,limn/splineFit.c:1568
+limnCbfMulti,int,1,0,limn,limn/splineFit.c:1770
+limnCbfGo,int,1,0,limn,limn/splineFit.c:1888
limnObjectWorldHomog,int,1,0,limn,limn/transform.c:25
limnObjectFaceNormals,int,1,0,limn,limn/transform.c:47
limnObjectSpaceTransform,int,1,0,limn,limn/transform.c:210
Modified: teem/trunk/python/cffi/cdef/cdef_limn.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_limn.h 2024-07-24 23:33:49 UTC (rev 7231)
+++ teem/trunk/python/cffi/cdef/cdef_limn.h 2024-07-24 23:36:11 UTC (rev 7232)
@@ -487,7 +487,7 @@
** note: "nrp" = Newton-based Re-Parameterization of where the given points
** fall along the spline, the iterative process inside limnCbfSingle
*/
-typedef struct {
+typedef struct limnCbfCtx_t {
/* ----------- input ---------- */
int verbose, /* verbosity level */
cornerFind, /* do first search for corners: places where the path is not
@@ -495,7 +495,13 @@
continuous between multiple spline segments) */
cornerNMS; /* (if cornerFind) non-minimal-suppression of corners: accept as
corners only those with locally minimal angle */
- unsigned int nrpIterMax; /* max # iters of nrp */
+ int (*cornerCB)(double *tvtNew, /* if corner, set new TVT */
+ const struct limnCbfCtx_t *fctx, /* this struct */
+ double angleMeas, /* measured angle */
+ const double *tvtMeas, /* measured TVT */
+ const double *vertOrig); /* original vertex pos */
+ const void *cornerCBData; /* holds extra info for cornerCB */
+ unsigned int nrpIterMax; /* max # iters of nrp */
double
epsilon, /* error threshold on min distance from spline (as currently parameterized)
to given points: this affects both splitting done by limnCbfMulti, and
@@ -516,20 +522,20 @@
nrpPsi, /* don't even try nrp if max dist is bigger than nrpPsi*epsilon, instead
just subdivide */
nrpDeltaThresh, /* finish npr when mean parameterization change fall below this */
- alphaMin, /* alpha can't be negative, and we enforce distinct positivity to ensure
- that spline doesn't slow down too much near endpoints */
- detMin, /* abs(determinant) of 2x2 matrix to invert can't go below this */
- cornAngle, /* interior angle, in degrees, between (one-sided) incoming and outgoing
- tangents, *below* which a vertex should be considered a corner.
- Vertices in a straight line have an angle of 180 degrees. */
- wackyAngle; /* in cases where we are only looking at three points: a spline can
- always be fit through the middle point, even with constraints on
- position and tangent at first and last points, but the spline looks
- wacky if its tangent at the middle point is wildly different than
- the (two-sided) tangent that would have been estimated at that point
- for the purpose of splitting. If the angle (in degrees) between the
- two tangents exceeds this, then fitting will generate the simple
- (punted) arc, which will likely trigger splitting. */
+ alphaMin, /* alpha can't be negative, and we enforce distinct positivity to ensure
+ that spline doesn't slow down too much near endpoints */
+ detMin, /* abs(determinant) of 2x2 matrix to invert can't go below this */
+ cornerAngle, /* interior angle, in degrees, between (one-sided) incoming and outgoing
+ tangents, *below* which a vertex should be considered a corner.
+ Vertices in a straight line have an angle of 180 degrees. */
+ wackyAngle; /* in cases where we are only looking at three points: a spline can
+ always be fit through the middle point, even with constraints on
+ position and tangent at first and last points, but the spline looks
+ wacky if its tangent at the middle point is wildly different than
+ the (two-sided) tangent that would have been estimated at that point
+ for the purpose of splitting. If the angle (in degrees) between the
+ two tangents exceeds this, then fitting will generate the simple
+ (punted) arc, which will likely trigger splitting. */
/* ----------- internal --------- */
double *uu, /* used for nrp: buffer of parameterizations in [0,1] of point along
currently considered spline segment */
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2024-07-24 23:33:49 UTC (rev 7231)
+++ teem/trunk/python/cffi/teem.py 2024-07-24 23:36:11 UTC (rev 7232)
@@ -433,14 +433,14 @@
'limnSplineUpdate': (_equals_one, 0, b'limn', 'limn/splineMethods.c:422'),
'limnSplineTypeSpecParse': (_equals_null, 0, b'limn', 'limn/splineMisc.c:222'),
'limnSplineParse': (_equals_null, 0, b'limn', 'limn/splineMisc.c:278'),
- 'limnCbfPointsNew': (_equals_null, 0, b'limn', 'limn/splineFit.c:175'),
- 'limnCbfPointsCheck': (_equals_one, 0, b'limn', 'limn/splineFit.c:247'),
- 'limnCbfCtxPrep': (_equals_one, 0, b'limn', 'limn/splineFit.c:516'),
- 'limnCbfTVT': (_equals_one, 0, b'limn', 'limn/splineFit.c:784'),
- 'limnCbfSingle': (_equals_one, 0, b'limn', 'limn/splineFit.c:1513'),
- 'limnCbfCorners': (_equals_one, 0, b'limn', 'limn/splineFit.c:1564'),
- 'limnCbfMulti': (_equals_one, 0, b'limn', 'limn/splineFit.c:1747'),
- 'limnCbfGo': (_equals_one, 0, b'limn', 'limn/splineFit.c:1865'),
+ 'limnCbfPointsNew': (_equals_null, 0, b'limn', 'limn/splineFit.c:177'),
+ 'limnCbfPointsCheck': (_equals_one, 0, b'limn', 'limn/splineFit.c:249'),
+ 'limnCbfCtxPrep': (_equals_one, 0, b'limn', 'limn/splineFit.c:520'),
+ 'limnCbfTVT': (_equals_one, 0, b'limn', 'limn/splineFit.c:788'),
+ 'limnCbfSingle': (_equals_one, 0, b'limn', 'limn/splineFit.c:1517'),
+ 'limnCbfCorners': (_equals_one, 0, b'limn', 'limn/splineFit.c:1568'),
+ 'limnCbfMulti': (_equals_one, 0, b'limn', 'limn/splineFit.c:1770'),
+ 'limnCbfGo': (_equals_one, 0, b'limn', 'limn/splineFit.c:1888'),
'limnObjectWorldHomog': (_equals_one, 0, b'limn', 'limn/transform.c:25'),
'limnObjectFaceNormals': (_equals_one, 0, b'limn', 'limn/transform.c:47'),
'limnObjectSpaceTransform': (_equals_one, 0, b'limn', 'limn/transform.c:210'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-24 23:33:53
|
Revision: 7231
http://sourceforge.net/p/teem/code/7231
Author: kindlmann
Date: 2024-07-24 23:33:49 +0000 (Wed, 24 Jul 2024)
Log Message:
-----------
main change: now can use a callback function as part of determining which vertices count as a corner
Modified Paths:
--------------
teem/trunk/src/limn/limn.h
teem/trunk/src/limn/lpu_cbfit.c
teem/trunk/src/limn/splineFit.c
Modified: teem/trunk/src/limn/limn.h
===================================================================
--- teem/trunk/src/limn/limn.h 2024-07-24 01:09:57 UTC (rev 7230)
+++ teem/trunk/src/limn/limn.h 2024-07-24 23:33:49 UTC (rev 7231)
@@ -552,7 +552,7 @@
** note: "nrp" = Newton-based Re-Parameterization of where the given points
** fall along the spline, the iterative process inside limnCbfSingle
*/
-typedef struct {
+typedef struct limnCbfCtx_t {
/* ----------- input ---------- */
int verbose, /* verbosity level */
cornerFind, /* do first search for corners: places where the path is not
@@ -560,7 +560,13 @@
continuous between multiple spline segments) */
cornerNMS; /* (if cornerFind) non-minimal-suppression of corners: accept as
corners only those with locally minimal angle */
- unsigned int nrpIterMax; /* max # iters of nrp */
+ int (*cornerCB)(double *tvtNew, /* if corner, set new TVT */
+ const struct limnCbfCtx_t *fctx, /* this struct */
+ double angleMeas, /* measured angle */
+ const double *tvtMeas, /* measured TVT */
+ const double *vertOrig); /* original vertex pos */
+ const void *cornerCBData; /* holds extra info for cornerCB */
+ unsigned int nrpIterMax; /* max # iters of nrp */
double
epsilon, /* error threshold on min distance from spline (as currently parameterized)
to given points: this affects both splitting done by limnCbfMulti, and
@@ -581,20 +587,20 @@
nrpPsi, /* don't even try nrp if max dist is bigger than nrpPsi*epsilon, instead
just subdivide */
nrpDeltaThresh, /* finish npr when mean parameterization change fall below this */
- alphaMin, /* alpha can't be negative, and we enforce distinct positivity to ensure
- that spline doesn't slow down too much near endpoints */
- detMin, /* abs(determinant) of 2x2 matrix to invert can't go below this */
- cornAngle, /* interior angle, in degrees, between (one-sided) incoming and outgoing
- tangents, *below* which a vertex should be considered a corner.
- Vertices in a straight line have an angle of 180 degrees. */
- wackyAngle; /* in cases where we are only looking at three points: a spline can
- always be fit through the middle point, even with constraints on
- position and tangent at first and last points, but the spline looks
- wacky if its tangent at the middle point is wildly different than
- the (two-sided) tangent that would have been estimated at that point
- for the purpose of splitting. If the angle (in degrees) between the
- two tangents exceeds this, then fitting will generate the simple
- (punted) arc, which will likely trigger splitting. */
+ alphaMin, /* alpha can't be negative, and we enforce distinct positivity to ensure
+ that spline doesn't slow down too much near endpoints */
+ detMin, /* abs(determinant) of 2x2 matrix to invert can't go below this */
+ cornerAngle, /* interior angle, in degrees, between (one-sided) incoming and outgoing
+ tangents, *below* which a vertex should be considered a corner.
+ Vertices in a straight line have an angle of 180 degrees. */
+ wackyAngle; /* in cases where we are only looking at three points: a spline can
+ always be fit through the middle point, even with constraints on
+ position and tangent at first and last points, but the spline looks
+ wacky if its tangent at the middle point is wildly different than
+ the (two-sided) tangent that would have been estimated at that point
+ for the purpose of splitting. If the angle (in degrees) between the
+ two tangents exceeds this, then fitting will generate the simple
+ (punted) arc, which will likely trigger splitting. */
/* ----------- internal --------- */
double *uu, /* used for nrp: buffer of parameterizations in [0,1] of point along
currently considered spline segment */
Modified: teem/trunk/src/limn/lpu_cbfit.c
===================================================================
--- teem/trunk/src/limn/lpu_cbfit.c 2024-07-24 01:09:57 UTC (rev 7230)
+++ teem/trunk/src/limn/lpu_cbfit.c 2024-07-24 23:33:49 UTC (rev 7231)
@@ -136,7 +136,7 @@
"scaling on nrp epsilon check");
sprintf(buff, "%.17g", fctx->nrpPsi);
hestOptAdd_1_Double(&hopt, "psi", "psi", &psi, buff, "psi, of course");
- sprintf(buff, "%.17g", fctx->cornAngle);
+ sprintf(buff, "%.17g", fctx->cornerAngle);
hestOptAdd_1_Double(&hopt, "ca", "angle", &cangle, buff,
"angle indicating a corner, or, "
"0 to say that no corner finding should be done");
@@ -327,7 +327,7 @@
fctx->nrpIota = nrpIota;
fctx->nrpPsi = psi;
if (cangle) {
- fctx->cornAngle = cangle;
+ fctx->cornerAngle = cangle;
fctx->cornerFind = AIR_TRUE;
} else {
fctx->cornerFind = AIR_FALSE;
Modified: teem/trunk/src/limn/splineFit.c
===================================================================
--- teem/trunk/src/limn/splineFit.c 2024-07-24 01:09:57 UTC (rev 7230)
+++ teem/trunk/src/limn/splineFit.c 2024-07-24 23:33:49 UTC (rev 7231)
@@ -38,6 +38,8 @@
the distance between the data and splines, so it is better at handling cases
where the chord-length-based parameterization initialization is terrible
- is smarter about handling single-spline fits to only 3 points
+- is more flexible about how corners (vertices without geometric continuity) are
+ defined and detected (including via callback)
- has robust error handling and error reporting
All of this adds implementation complexity (this is ~4 times longer than author's file)
@@ -55,7 +57,7 @@
neighbors of the point, with only lower or higher indies), or two-sided (looking at
neighbors on both sides of the point).
- corner: a point at which the angle between the one-sided tangents is below some
- threshold (limnCbfCtx->cornAngle), or, sometimes for completeness, the first and
+ threshold (limnCbfCtx->cornerAngle), or, sometimes for completeness, the first and
last points in an open path.
- span: a closed interval of point indices (typically "[loi,hii]"), within which
computations are done, often delimited by corners
@@ -161,7 +163,7 @@
described here, N=18 and N=19 do equally well (yay!)
*/
-#define PNMIN(ISLOOP) ((ISLOOP) ? 4 : 3)
+#define PNMIN(ISLOOP) ((ISLOOP) ? 3 : 3)
/*
limnCbfPointsNew
@@ -325,6 +327,8 @@
fctx->verbose = 0;
fctx->cornerFind = AIR_TRUE;
fctx->cornerNMS = AIR_TRUE;
+ fctx->cornerCB = NULL;
+ fctx->cornerCBData = NULL;
fctx->nrpIterMax = 40; /* authors originally thought ~6 */
fctx->epsilon = 0; /* NOTE: will need to be set to something valid elsewhere */
fctx->scale = 0; /* scale 0 means no filtering at all */
@@ -334,8 +338,8 @@
fctx->nrpDeltaThresh = 0.01;
fctx->alphaMin = 0.001;
fctx->detMin = 0.01;
- fctx->cornAngle = 120.0; /* degrees */
- fctx->wackyAngle = 30.0; /* degrees */
+ fctx->cornerAngle = 120.0; /* degrees */
+ fctx->wackyAngle = 30.0; /* degrees */
/* ----- internal state ----- */
/* initialize buffer pointers to NULL and buffer lengths to 0 */
fctx->uu = fctx->vw = fctx->tw = fctx->ctvt = NULL;
@@ -564,9 +568,9 @@
{
const double amin = 60;
const double amax = 180;
- if (!(amin <= fctx->cornAngle && fctx->cornAngle <= amax)) {
- biffAddf(LIMN, "%s: cornAngle (%g) outside sane range [%g,%g]", me,
- fctx->cornAngle, amin, amax);
+ if (!(amin <= fctx->cornerAngle && fctx->cornerAngle <= amax)) {
+ biffAddf(LIMN, "%s: cornerAngle (%g) outside sane range [%g,%g]", me,
+ fctx->cornerAngle, amin, amax);
return 1;
}
}
@@ -1612,6 +1616,12 @@
}
if (fctx->verbose) {
printf("%s: looking for corners among %u points\n", me, pnum);
+ if (fctx->verbose > 1 && pnum <= 10) {
+ const double *pp = PP(lpnt);
+ for (vi = 0; vi < pnum; vi++) {
+ printf(" %u: %g \t%g\n", vi, pp[0 + 2 * vi], pp[1 + 2 * vi]);
+ }
+ }
}
/* else we search for corners */
@@ -1653,7 +1663,18 @@
} else {
/* it is a loop, or: not a loop and at an interior point */
angle[vi] = 180 * ell_2v_angle_d(LT, RT) / AIR_PI;
- corny[vi] = (angle[vi] < fctx->cornAngle);
+ if (fctx->cornerCB) {
+ double tvtNew[6];
+ if (fctx->cornerCB(tvtNew, fctx, angle[vi], vtvt + 0 + 6 * vi,
+ PPlowerI(lpnt, vi))) {
+ corny[vi] = AIR_TRUE;
+ ELL_6V_COPY(vtvt + 0 + 6 * vi, tvtNew);
+ } else {
+ corny[vi] = AIR_FALSE;
+ }
+ } else {
+ corny[vi] = (angle[vi] < fctx->cornerAngle);
+ }
}
if (fctx->verbose > 1) {
printf("%s: vi=%3u corny %d angle %g\n", me, vi, corny[vi], angle[vi]);
@@ -1663,7 +1684,9 @@
}
}
}
- if (fctx->cornerNMS) {
+ if (fctx->cornerNMS && pnum >= 6) {
+ /* we only try non-maximal-supression on longer loops (HEY hard-coded value here);
+ ideally this would be a user-set-able parameter, but it would be very rarely set */
for (vi = 0; vi < pnum; vi++) {
if (!lpnt->isLoop && (!vi || vi == pnum - 1)) {
/* not a loop, and, either at first or last point ==> must stay a "corner" */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-24 01:09:58
|
Revision: 7230
http://sourceforge.net/p/teem/code/7230
Author: kindlmann
Date: 2024-07-24 01:09:57 +0000 (Wed, 24 Jul 2024)
Log Message:
-----------
syncing with source
Modified Paths:
--------------
teem/trunk/python/cffi/biffdata/limn.csv
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/biffdata/limn.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/limn.csv 2024-07-24 01:06:15 UTC (rev 7229)
+++ teem/trunk/python/cffi/biffdata/limn.csv 2024-07-24 01:09:57 UTC (rev 7230)
@@ -64,10 +64,10 @@
limnCbfPointsCheck,int,1,0,limn,limn/splineFit.c:247
limnCbfCtxPrep,int,1,0,limn,limn/splineFit.c:516
limnCbfTVT,int,1,0,limn,limn/splineFit.c:784
-limnCbfSingle,int,1,0,limn,limn/splineFit.c:1512
-limnCbfCorners,int,1,0,limn,limn/splineFit.c:1563
-limnCbfMulti,int,1,0,limn,limn/splineFit.c:1746
-limnCbfGo,int,1,0,limn,limn/splineFit.c:1864
+limnCbfSingle,int,1,0,limn,limn/splineFit.c:1513
+limnCbfCorners,int,1,0,limn,limn/splineFit.c:1564
+limnCbfMulti,int,1,0,limn,limn/splineFit.c:1747
+limnCbfGo,int,1,0,limn,limn/splineFit.c:1865
limnObjectWorldHomog,int,1,0,limn,limn/transform.c:25
limnObjectFaceNormals,int,1,0,limn,limn/transform.c:47
limnObjectSpaceTransform,int,1,0,limn,limn/transform.c:210
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2024-07-24 01:06:15 UTC (rev 7229)
+++ teem/trunk/python/cffi/teem.py 2024-07-24 01:09:57 UTC (rev 7230)
@@ -437,10 +437,10 @@
'limnCbfPointsCheck': (_equals_one, 0, b'limn', 'limn/splineFit.c:247'),
'limnCbfCtxPrep': (_equals_one, 0, b'limn', 'limn/splineFit.c:516'),
'limnCbfTVT': (_equals_one, 0, b'limn', 'limn/splineFit.c:784'),
- 'limnCbfSingle': (_equals_one, 0, b'limn', 'limn/splineFit.c:1512'),
- 'limnCbfCorners': (_equals_one, 0, b'limn', 'limn/splineFit.c:1563'),
- 'limnCbfMulti': (_equals_one, 0, b'limn', 'limn/splineFit.c:1746'),
- 'limnCbfGo': (_equals_one, 0, b'limn', 'limn/splineFit.c:1864'),
+ 'limnCbfSingle': (_equals_one, 0, b'limn', 'limn/splineFit.c:1513'),
+ 'limnCbfCorners': (_equals_one, 0, b'limn', 'limn/splineFit.c:1564'),
+ 'limnCbfMulti': (_equals_one, 0, b'limn', 'limn/splineFit.c:1747'),
+ 'limnCbfGo': (_equals_one, 0, b'limn', 'limn/splineFit.c:1865'),
'limnObjectWorldHomog': (_equals_one, 0, b'limn', 'limn/transform.c:25'),
'limnObjectFaceNormals': (_equals_one, 0, b'limn', 'limn/transform.c:47'),
'limnObjectSpaceTransform': (_equals_one, 0, b'limn', 'limn/transform.c:210'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-24 01:06:17
|
Revision: 7229
http://sourceforge.net/p/teem/code/7229
Author: kindlmann
Date: 2024-07-24 01:06:15 +0000 (Wed, 24 Jul 2024)
Log Message:
-----------
fixing problem with nan generation from scale>0 vertex pos == orig pos
Modified Paths:
--------------
teem/trunk/src/limn/splineFit.c
Modified: teem/trunk/src/limn/splineFit.c
===================================================================
--- teem/trunk/src/limn/splineFit.c 2024-07-23 17:05:13 UTC (rev 7228)
+++ teem/trunk/src/limn/splineFit.c 2024-07-24 01:06:15 UTC (rev 7229)
@@ -893,20 +893,21 @@
/* limit distance from chosen (x,y) datapoint to posC to be (yes, harcoded) 95% of
fctx->epsilon. Being allowed to be further away can cause annoyances (for GLK in
some early stage of debugging) */
- double off[2], offlen, clofflen,
- okoff = 0.95 * fctx->epsilon; /* DIM=2 throughout */
+ double off[2], offlen, okoff = 0.95 * fctx->epsilon; /* DIM=2 throughout */
const double *xy = PPlowerI(lpnt, svi); /* center vertex in given data */
- ELL_2V_SUB(off, posC, xy); /* off = posC - xy, from given to computed */
- ELL_2V_NORM(off, off, offlen); /* offlen = |off|; off /= |off| */
- clofflen = AIR_MIN(okoff, offlen);
- /* difference between chosen (x,y) datapoint and spline endpoint
- can be in any direction, but we limit the length */
- ELL_2V_SCALE_ADD2(posC, 1, xy, clofflen, off);
- if (fctx->verbose > 1) {
- printf("%s: clamping |posC - xy[%d]=(%g,%g)| dist %g to %g = %g --> (%g,%g)\n",
- me, svi, xy[0], xy[1], offlen, okoff, clofflen, posC[0], posC[1]);
- printf("%s: also: posM = (%g,%g) posP = (%g,%g)\n", me, posM[0], posM[0],
- posP[0], posP[1]);
+ ELL_2V_SUB(off, posC, xy); /* off = posC - xy, from given to computed */
+ ELL_2V_NORM(off, off, offlen); /* offlen = |off|; off /= |off| */
+ if (offlen > fctx->epsilon / 100) { /* real difference between posC and xy */
+ double clofflen = AIR_MIN(okoff, offlen); /* clamped offlen */
+ /* difference between chosen (x,y) datapoint and spline endpoint
+ can be in any direction, but we limit the length */
+ ELL_2V_SCALE_ADD2(posC, 1, xy, clofflen, off);
+ if (fctx->verbose > 1) {
+ printf("%s: clamping |posC - xy[%d]=(%g,%g)| dist %g to %g = %g --> (%g,%g)\n",
+ me, svi, xy[0], xy[1], offlen, okoff, clofflen, posC[0], posC[1]);
+ printf("%s: also: posM = (%g,%g) posP = (%g,%g)\n", me, posM[0], posM[0],
+ posP[0], posP[1]);
+ }
}
}
if (lt) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-23 17:05:14
|
Revision: 7228
http://sourceforge.net/p/teem/code/7228
Author: kindlmann
Date: 2024-07-23 17:05:13 +0000 (Tue, 23 Jul 2024)
Log Message:
-----------
syncing with source
Modified Paths:
--------------
teem/trunk/python/cffi/biffdata/limn.csv
teem/trunk/python/cffi/cdef/cdef_limn.h
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/biffdata/limn.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/limn.csv 2024-07-23 16:57:52 UTC (rev 7227)
+++ teem/trunk/python/cffi/biffdata/limn.csv 2024-07-23 17:05:13 UTC (rev 7228)
@@ -62,12 +62,12 @@
limnSplineParse,limnSpline *,NULL,0,limn,limn/splineMisc.c:278
limnCbfPointsNew,limnCbfPoints *,NULL,0,limn,limn/splineFit.c:175
limnCbfPointsCheck,int,1,0,limn,limn/splineFit.c:247
-limnCbfCtxPrep,int,1,0,limn,limn/splineFit.c:515
-limnCbfTVT,int,1,0,limn,limn/splineFit.c:783
-limnCbfSingle,int,1,0,limn,limn/splineFit.c:1511
-limnCbfCorners,int,1,0,limn,limn/splineFit.c:1562
-limnCbfMulti,int,1,0,limn,limn/splineFit.c:1745
-limnCbfGo,int,1,0,limn,limn/splineFit.c:1863
+limnCbfCtxPrep,int,1,0,limn,limn/splineFit.c:516
+limnCbfTVT,int,1,0,limn,limn/splineFit.c:784
+limnCbfSingle,int,1,0,limn,limn/splineFit.c:1512
+limnCbfCorners,int,1,0,limn,limn/splineFit.c:1563
+limnCbfMulti,int,1,0,limn,limn/splineFit.c:1746
+limnCbfGo,int,1,0,limn,limn/splineFit.c:1864
limnObjectWorldHomog,int,1,0,limn,limn/transform.c:25
limnObjectFaceNormals,int,1,0,limn,limn/transform.c:47
limnObjectSpaceTransform,int,1,0,limn,limn/transform.c:210
Modified: teem/trunk/python/cffi/cdef/cdef_limn.h
===================================================================
--- teem/trunk/python/cffi/cdef/cdef_limn.h 2024-07-23 16:57:52 UTC (rev 7227)
+++ teem/trunk/python/cffi/cdef/cdef_limn.h 2024-07-23 17:05:13 UTC (rev 7228)
@@ -459,10 +459,11 @@
double xy[8]; /* four control points of cubic Bezier:
x0, y0, x1, y1, x2, y2, x3, y3
0 1 2 3 4 5 6 7 DIM=2 */
- int corner[2]; /* corner[0,1] non-zero if xy[0,3] are either corner vertices
- or path-ending vertices, i.e. reasons to not have geometric
- continuity here, either because we intend to have a corner,
- or because there's nothing else to be continuous with */
+ int corner[2]; /* corner[0] is non-zero if vertex xy[0,1] is either a corner vertex
+ or a path-ending vertex, i.e. reasons to NOT have geometric
+ continuity there, either because we intend to have a corner,
+ or because there's nothing else to be continuous with.
+ corner[1] describes the same for xy[6,7]. */
/* how many points does this represent */
unsigned int pointNum;
} limnCbfSeg;
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2024-07-23 16:57:52 UTC (rev 7227)
+++ teem/trunk/python/cffi/teem.py 2024-07-23 17:05:13 UTC (rev 7228)
@@ -435,12 +435,12 @@
'limnSplineParse': (_equals_null, 0, b'limn', 'limn/splineMisc.c:278'),
'limnCbfPointsNew': (_equals_null, 0, b'limn', 'limn/splineFit.c:175'),
'limnCbfPointsCheck': (_equals_one, 0, b'limn', 'limn/splineFit.c:247'),
- 'limnCbfCtxPrep': (_equals_one, 0, b'limn', 'limn/splineFit.c:515'),
- 'limnCbfTVT': (_equals_one, 0, b'limn', 'limn/splineFit.c:783'),
- 'limnCbfSingle': (_equals_one, 0, b'limn', 'limn/splineFit.c:1511'),
- 'limnCbfCorners': (_equals_one, 0, b'limn', 'limn/splineFit.c:1562'),
- 'limnCbfMulti': (_equals_one, 0, b'limn', 'limn/splineFit.c:1745'),
- 'limnCbfGo': (_equals_one, 0, b'limn', 'limn/splineFit.c:1863'),
+ 'limnCbfCtxPrep': (_equals_one, 0, b'limn', 'limn/splineFit.c:516'),
+ 'limnCbfTVT': (_equals_one, 0, b'limn', 'limn/splineFit.c:784'),
+ 'limnCbfSingle': (_equals_one, 0, b'limn', 'limn/splineFit.c:1512'),
+ 'limnCbfCorners': (_equals_one, 0, b'limn', 'limn/splineFit.c:1563'),
+ 'limnCbfMulti': (_equals_one, 0, b'limn', 'limn/splineFit.c:1746'),
+ 'limnCbfGo': (_equals_one, 0, b'limn', 'limn/splineFit.c:1864'),
'limnObjectWorldHomog': (_equals_one, 0, b'limn', 'limn/transform.c:25'),
'limnObjectFaceNormals': (_equals_one, 0, b'limn', 'limn/transform.c:47'),
'limnObjectSpaceTransform': (_equals_one, 0, b'limn', 'limn/transform.c:210'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-23 16:57:54
|
Revision: 7227
http://sourceforge.net/p/teem/code/7227
Author: kindlmann
Date: 2024-07-23 16:57:52 +0000 (Tue, 23 Jul 2024)
Log Message:
-----------
more complete use of nrrdHestNrrdNoTTY instead of nrrdHestNrrd
Modified Paths:
--------------
teem/trunk/src/unrrdu/aabplot.c
teem/trunk/src/unrrdu/ccmerge.c
teem/trunk/src/unrrdu/crop.c
teem/trunk/src/unrrdu/dering.c
teem/trunk/src/unrrdu/diff.c
teem/trunk/src/unrrdu/histo.c
teem/trunk/src/unrrdu/ilk.c
teem/trunk/src/unrrdu/imap.c
teem/trunk/src/unrrdu/inset.c
teem/trunk/src/unrrdu/jhisto.c
teem/trunk/src/unrrdu/join.c
teem/trunk/src/unrrdu/lut.c
teem/trunk/src/unrrdu/lut2.c
teem/trunk/src/unrrdu/mlut.c
teem/trunk/src/unrrdu/mrmap.c
teem/trunk/src/unrrdu/ninspect.c
teem/trunk/src/unrrdu/privateUnrrdu.h
teem/trunk/src/unrrdu/rmap.c
teem/trunk/src/unrrdu/splice.c
teem/trunk/src/unrrdu/sselect.c
teem/trunk/src/unrrdu/vidicon.c
Modified: teem/trunk/src/unrrdu/aabplot.c
===================================================================
--- teem/trunk/src/unrrdu/aabplot.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/aabplot.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -51,7 +51,7 @@
"if given a 1D nrrd here that matches the number of "
"rows in the \"-i\" input, interpret it as a list of values "
"that should be indicated with \"X\"s in the plots.",
- nrrdHestNrrd);
+ nrrdHestNrrdNoTTY);
mop = airMopNew();
airMopAdd(mop, opt, hestOptFree_vp, airMopAlways);
Modified: teem/trunk/src/unrrdu/ccmerge.c
===================================================================
--- teem/trunk/src/unrrdu/ccmerge.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/ccmerge.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -69,7 +69,7 @@
"for value-directed merging (with non-zero \"-d\" option), "
"or if the \"-revalue\" option is given, "
"but is not needed otherwise",
- nrrdHestNrrd);
+ nrrdHestNrrdNoTTY);
OPT_ADD_NOUT(out, "output nrrd");
mop = airMopNew();
Modified: teem/trunk/src/unrrdu/crop.c
===================================================================
--- teem/trunk/src/unrrdu/crop.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/crop.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -61,7 +61,7 @@
"-min, second is for -max. Unfortunately the "
"\"m\" and \"M\" semantics (above) are currently not "
"supported in the bounds file.",
- nrrdHestNrrd);
+ nrrdHestNrrdNoTTY);
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/dering.c
===================================================================
--- teem/trunk/src/unrrdu/dering.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/dering.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -72,7 +72,7 @@
"output where mask=1. This lerp is effectively the same "
"as a \"unu 3op lerp\", so this should either be match the "
"input in size, or match its slices along the slowest axis.",
- nrrdHestNrrd);
+ nrrdHestNrrdNoTTY);
hestOptAdd_1_Double(&opt, "b,back", "val", &backval, "0.0",
"when using a mask (\"-m\"), the background value to "
"lerp with.");
Modified: teem/trunk/src/unrrdu/diff.c
===================================================================
--- teem/trunk/src/unrrdu/diff.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/diff.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -42,9 +42,10 @@
char explain[AIR_STRLEN_LARGE + 1];
mop = airMopNew();
- hestOptAdd_1_Other(&opt, NULL, "ninA", &ninA, NULL, "First input nrrd.", nrrdHestNrrd);
+ hestOptAdd_1_Other(&opt, NULL, "ninA", &ninA, NULL, "First input nrrd.",
+ nrrdHestNrrdNoTTY);
hestOptAdd_1_Other(&opt, NULL, "ninB", &ninB, NULL, "Second input nrrd.",
- nrrdHestNrrd);
+ nrrdHestNrrdNoTTY);
hestOptAdd_1_Double(&opt, "eps,epsilon", "eps", &epsilon, "0.0",
"threshold for allowable difference in values in "
"data values");
Modified: teem/trunk/src/unrrdu/histo.c
===================================================================
--- teem/trunk/src/unrrdu/histo.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/histo.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -45,7 +45,7 @@
"(not using this option), the increment is one bin count per "
"sample, but by giving a nrrd, the value in the nrrd at the "
"corresponding location will be the bin count increment ",
- nrrdHestNrrd);
+ nrrdHestNrrdNoTTY);
hestOptAdd_1_String(&opt, "min,minimum", "value", &minStr, "nan",
"Value at low end of histogram, given explicitly as a "
"regular number, "
Modified: teem/trunk/src/unrrdu/ilk.c
===================================================================
--- teem/trunk/src/unrrdu/ilk.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/ilk.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -284,7 +284,7 @@
"transform is set up to regularly sample the rectangle that, due to "
"perspective distortion, has corners with the X,Y coordinates given in "
"this filename, in scan-line order.",
- nrrdHestNrrd);
+ nrrdHestNrrdNoTTY);
hestOptAdd_1_Enum(&opt, "b", "boundary", &bound, "bleed",
"what to do when sampling outside original image.\n "
"\b\bo \"bleed\": copy values at image border outward\n "
@@ -307,7 +307,7 @@
hestOptAdd_2_Int(&opt, "db", "x y", debug, "-1 -1",
"if both non-negative, turn on verbose debugging for this output "
"image pixel");
- hestOptAdd_1_Other(&opt, "i", "image", &nin, "-", "input 2D image", nrrdHestNrrd);
+ hestOptAdd_1_Other(&opt, "i", "image", &nin, "-", "input 2D image", nrrdHestNrrdNoTTY);
OPT_ADD_NOUT(outS, "output image");
mop = airMopNew();
Modified: teem/trunk/src/unrrdu/imap.c
===================================================================
--- teem/trunk/src/unrrdu/imap.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/imap.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -46,7 +46,7 @@
double min, max;
hestOptAdd_1_Other(&opt, "m,map", "map", &nmap, NULL,
- "irregular map to map input nrrd through", nrrdHestNrrd);
+ "irregular map to map input nrrd through", nrrdHestNrrdNoTTY);
hestOptAdd_1_UInt(&opt, "l,length", "aclLen", &aclLen, "0",
"length of accelerator array, used to try to speed-up "
"task of finding between which pair of control points "
Modified: teem/trunk/src/unrrdu/inset.c
===================================================================
--- teem/trunk/src/unrrdu/inset.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/inset.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -47,7 +47,7 @@
minLen);
hestOptAdd_1_Other(&opt, "s,subset", "nsub", &(nsub), NULL,
"sub-region nrrd. This the data to be inset in \"nin\"",
- nrrdHestNrrd);
+ nrrdHestNrrdNoTTY);
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/jhisto.c
===================================================================
--- teem/trunk/src/unrrdu/jhisto.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/jhisto.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -53,7 +53,7 @@
"(not using this option), the increment is one bin count per "
"sample, but by giving a nrrd, the value in the nrrd at the "
"corresponding location will be the bin count increment ",
- nrrdHestNrrd);
+ nrrdHestNrrdNoTTY);
hestOptAdd_Nv_Double(&opt, "min,minimum", "min0 min1", 2, -1, &min, "nan nan",
"min<i> is the low range of values to be quantized along "
"axis i; use \"nan\" to represent lowest value present ",
@@ -70,7 +70,7 @@
hestOptAdd_Nv_Other(&opt, "i,input", "nin0 [nin1]", 1, -1, &nin, "-",
"list of nrrds (one for each axis of joint histogram), "
"or, single nrrd that will be sliced along specified axis.",
- &ninLen, nrrdHestNrrd);
+ &ninLen, nrrdHestNrrdNoTTY);
hestOptAdd_1_UInt(&opt, "a,axis", "axis", &diceax, "0",
"axis to slice along when working with single nrrd. ");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/join.c
===================================================================
--- teem/trunk/src/unrrdu/join.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/join.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -50,7 +50,7 @@
hparm->respFileEnable = AIR_TRUE;
hestOptAdd_Nv_Other(&opt, "i,input", "nin0", 1, -1, &nin, NULL,
- "everything to be joined together", &ninLen, nrrdHestNrrd);
+ "everything to be joined together", &ninLen, nrrdHestNrrdNoTTY);
OPT_ADD_AXIS(axis, "axis to join along");
hestOptAdd_Flag(&opt, "incr", &incrDim,
"in situations where the join axis is *not* among the existing "
Modified: teem/trunk/src/unrrdu/lut.c
===================================================================
--- teem/trunk/src/unrrdu/lut.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/lut.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -43,7 +43,7 @@
NrrdRange *range = NULL;
hestOptAdd_1_Other(&opt, "m,map", "lut", &nlut, NULL,
- "lookup table to map input nrrd through", nrrdHestNrrd);
+ "lookup table to map input nrrd through", nrrdHestNrrdNoTTY);
hestOptAdd_Flag(&opt, "r,rescale", &rescale,
"rescale the input values from the input range to the "
"lut domain. The lut domain is either explicitly "
Modified: teem/trunk/src/unrrdu/lut2.c
===================================================================
--- teem/trunk/src/unrrdu/lut2.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/lut2.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -44,7 +44,7 @@
unsigned int mapAxis, rai;
hestOptAdd_1_Other(&opt, "m,map", "lut", &nlut, NULL,
- "lookup table to map input nrrd through", nrrdHestNrrd);
+ "lookup table to map input nrrd through", nrrdHestNrrdNoTTY);
hestOptAdd_2_Bool(&opt, "r,rescale", "bool bool", rescale, "false false",
"rescale one or both of the input values from the "
"input range to the lut domain. The lut domain is either "
Modified: teem/trunk/src/unrrdu/mlut.c
===================================================================
--- teem/trunk/src/unrrdu/mlut.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/mlut.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -46,7 +46,7 @@
"one nrrd of lookup tables to map input nrrd through, or, "
"list of nrrds which contain the individual entries of "
"the lookup table at each voxel, which will be joined together.",
- &_nmlutLen, nrrdHestNrrd);
+ &_nmlutLen, nrrdHestNrrdNoTTY);
hestOptAdd_Flag(&opt, "r,rescale", &rescale,
"rescale the input values from the input range to the "
"lut domain. The lut domain is either explicitly "
Modified: teem/trunk/src/unrrdu/mrmap.c
===================================================================
--- teem/trunk/src/unrrdu/mrmap.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/mrmap.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -46,7 +46,7 @@
"one nrrd of regular maps to map input nrrd through, or, "
"list of nrrds which contain the individual entries of the map "
"at each voxel, which will be joined together.",
- &_nmmapLen, nrrdHestNrrd);
+ &_nmmapLen, nrrdHestNrrdNoTTY);
hestOptAdd_Flag(&opt, "r,rescale", &rescale,
"rescale the input values from the input range to the "
"map domain. The map domain is either explicitly "
Modified: teem/trunk/src/unrrdu/ninspect.c
===================================================================
--- teem/trunk/src/unrrdu/ninspect.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/ninspect.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -342,7 +342,8 @@
mop = airMopNew();
hestOptAdd_1_Other(&opt, "i", "nin", &nin, "-",
- "input nrrd to project. Must be three dimensional.", nrrdHestNrrd);
+ "input nrrd to project. Must be three dimensional.",
+ nrrdHestNrrdNoTTY);
hestOptAdd_1_Float(&opt, "amt", "heq", &heqamount, "0.5",
"how much to apply histogram equalization to projection images");
hestOptAdd_1_UInt(
Modified: teem/trunk/src/unrrdu/privateUnrrdu.h
===================================================================
--- teem/trunk/src/unrrdu/privateUnrrdu.h 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/privateUnrrdu.h 2024-07-23 16:57:52 UTC (rev 7227)
@@ -189,7 +189,7 @@
*/
/* Nrrd *var */
#define OPT_ADD_NIN(var, desc) \
- hestOptAdd_1_Other(&opt, "i,input", "nin", &(var), "-", desc, nrrdHestNrrd)
+ hestOptAdd_1_Other(&opt, "i,input", "nin", &(var), "-", desc, nrrdHestNrrdNoTTY)
/* char *var */
#define OPT_ADD_NOUT(var, desc) \
Modified: teem/trunk/src/unrrdu/rmap.c
===================================================================
--- teem/trunk/src/unrrdu/rmap.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/rmap.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -50,7 +50,7 @@
double min, max;
hestOptAdd_1_Other(&opt, "m,map", "map", &nmap, NULL,
- "regular map to map input nrrd through", nrrdHestNrrd);
+ "regular map to map input nrrd through", nrrdHestNrrdNoTTY);
hestOptAdd_Flag(&opt, "r,rescale", &rescale,
"rescale the input values from the input range to the "
"map domain. The map domain is either explicitly "
Modified: teem/trunk/src/unrrdu/splice.c
===================================================================
--- teem/trunk/src/unrrdu/splice.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/splice.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -47,7 +47,7 @@
&unrrduHestPosCB);
hestOptAdd_1_Other(&opt, "s,slice", "nslice", &(nslice), NULL,
"slice nrrd. This is the slice to insert into \"nin\"",
- nrrdHestNrrd);
+ nrrdHestNrrdNoTTY);
OPT_ADD_NIN(nin, "input nrrd. This is the nrrd into which the slice is "
"inserted");
OPT_ADD_NOUT(out, "output nrrd");
Modified: teem/trunk/src/unrrdu/sselect.c
===================================================================
--- teem/trunk/src/unrrdu/sselect.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/sselect.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -43,7 +43,8 @@
OPT_ADD_NIN(nin, "input nrrd");
OPT_ADD_AXIS(axis, "axis to slice along");
hestOptAdd_1_Other(&opt, "s,selector", "nline", &nline, NULL,
- "the 1-D nrrd of values to compare with threshold", nrrdHestNrrd);
+ "the 1-D nrrd of values to compare with threshold",
+ nrrdHestNrrdNoTTY);
hestOptAdd_1_Double(&opt, "th", "thresh", &thresh, NULL, "threshold on selector line");
hestOptAdd_2_String(&opt, "o,output", "above below", outS, "- x",
"outputs for slices corresponding to values "
Modified: teem/trunk/src/unrrdu/vidicon.c
===================================================================
--- teem/trunk/src/unrrdu/vidicon.c 2024-07-23 16:53:39 UTC (rev 7226)
+++ teem/trunk/src/unrrdu/vidicon.c 2024-07-23 16:57:52 UTC (rev 7227)
@@ -44,7 +44,7 @@
hparm->elideSingleOtherDefault = AIR_FALSE;
hestOptAdd_1_Other(&opt, "i", "input", &nin, NULL,
- "input image. Should be grayscale PNG.", nrrdHestNrrd);
+ "input image. Should be grayscale PNG.", nrrdHestNrrdNoTTY);
hestOptAdd_1_Double(&opt, "rs", "rescale", &rescale, "0.75",
"how to rescale (downsample) the image prior to processing, "
"just to get a better representation of the floating-point "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-23 16:53:40
|
Revision: 7226
http://sourceforge.net/p/teem/code/7226
Author: kindlmann
Date: 2024-07-23 16:53:39 +0000 (Tue, 23 Jul 2024)
Log Message:
-----------
clang format, and using nrrdHestNrrdNoTTY
Modified Paths:
--------------
teem/trunk/src/seek/test/tiso.c
teem/trunk/src/seek/test/trv.c
Modified: teem/trunk/src/seek/test/tiso.c
===================================================================
--- teem/trunk/src/seek/test/tiso.c 2024-07-23 16:52:53 UTC (rev 7225)
+++ teem/trunk/src/seek/test/tiso.c 2024-07-23 16:53:39 UTC (rev 7226)
@@ -27,10 +27,10 @@
main(int argc, const char *argv[]) {
const char *me;
char *err, *outS;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
limnPolyData *pld;
- gageContext *gctx=NULL;
+ gageContext *gctx = NULL;
gagePerVolume *pvl;
Nrrd *nin, *nmeas;
double isoval, kparm[3];
@@ -41,17 +41,13 @@
me = argv[0];
hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL,
- "input volume to surface",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "v", "iso", airTypeDouble, 1, 1, &isoval, NULL,
- "isovalue");
- hestOptAdd(&hopt, "g", NULL, airTypeInt, 0, 0, &usegage, NULL,
- "use gage too");
+ "input volume to surface", NULL, NULL, nrrdHestNrrdNoTTY);
+ hestOptAdd(&hopt, "v", "iso", airTypeDouble, 1, 1, &isoval, NULL, "isovalue");
+ hestOptAdd(&hopt, "g", NULL, airTypeInt, 0, 0, &usegage, NULL, "use gage too");
hestOptAdd(&hopt, "hack", NULL, airTypeInt, 0, 0, &hack, NULL, "hack");
hestOptAdd(&hopt, "o", "output LMPD", airTypeString, 1, 1, &outS, "out.lmpd",
"output file to save LMPD into");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
@@ -84,7 +80,8 @@
|| gageUpdate(gctx)) {
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
@@ -97,8 +94,7 @@
ELL_3V_SET(samples, 5, 5, 5);
if (!E) E |= seekSamplesSet(sctx, samples);
if (!E) E |= seekItemGradientSet(sctx, gageSclGradVec);
- if (!E) E |= seekItemEigensystemSet(sctx, gageSclHessEval,
- gageSclHessEvec);
+ if (!E) E |= seekItemEigensystemSet(sctx, gageSclHessEval, gageSclHessEvec);
if (!E) E |= seekItemNormalSet(sctx, gageSclHessEvec2);
} else {
if (!E) E |= seekItemScalarSet(sctx, gageSclValue);
@@ -119,14 +115,14 @@
if (E) {
airMopAdd(mop, err = biffGetDone(SEEK), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
fprintf(stderr, "%s: extraction time = %g\n", me, sctx->time);
nmeas = nrrdNew();
airMopAdd(mop, nmeas, (airMopper)nrrdNuke, airMopAlways);
- if (limnPolyDataCCFind(pld)
- || limnPolyDataPrimitiveArea(nmeas, pld)
+ if (limnPolyDataCCFind(pld) || limnPolyDataPrimitiveArea(nmeas, pld)
|| limnPolyDataPrimitiveSort(pld, nmeas)) {
err = biffGetDone(LIMN);
fprintf(stderr, "%s: trouble sorting:\n%s", me, err);
@@ -136,7 +132,8 @@
if (limnPolyDataWriteLMPD(file, pld)) {
airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopOkay(mop);
Modified: teem/trunk/src/seek/test/trv.c
===================================================================
--- teem/trunk/src/seek/test/trv.c 2024-07-23 16:52:53 UTC (rev 7225)
+++ teem/trunk/src/seek/test/trv.c 2024-07-23 16:53:39 UTC (rev 7226)
@@ -86,7 +86,7 @@
me = argv[0];
hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &nin, NULL,
- "input volume to analyze", NULL, NULL, nrrdHestNrrd);
+ "input volume to analyze", NULL, NULL, nrrdHestNrrdNoTTY);
hestOptAdd(&hopt, "k", "kind", airTypeOther, 1, 1, &kind, NULL,
"\"kind\" of volume (\"scalar\", \"vector\", \"tensor\")", NULL, NULL,
&probeKindHestCB);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-23 16:52:55
|
Revision: 7225
http://sourceforge.net/p/teem/code/7225
Author: kindlmann
Date: 2024-07-23 16:52:53 +0000 (Tue, 23 Jul 2024)
Log Message:
-----------
clang format, and using nrrdHestNrrdNoTTY
Modified Paths:
--------------
teem/trunk/src/limn/test/clip.c
teem/trunk/src/limn/test/off2eps.c
teem/trunk/src/limn/test/tbc.c
Modified: teem/trunk/src/limn/test/clip.c
===================================================================
--- teem/trunk/src/limn/test/clip.c 2024-07-23 16:51:37 UTC (rev 7224)
+++ teem/trunk/src/limn/test/clip.c 2024-07-23 16:52:53 UTC (rev 7225)
@@ -27,7 +27,7 @@
main(int argc, const char *argv[]) {
const char *me;
char *err, *outS;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
limnPolyData *pld;
@@ -37,18 +37,15 @@
int bitflag;
me = argv[0];
- hestOptAdd(&hopt, "vi", "nin", airTypeOther, 1, 1, &nin, NULL,
- "input values",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "pi", "lpld", airTypeOther, 1, 1, &pld, NULL,
- "input polydata",
- NULL, NULL, limnHestPolyDataLMPD);
+ hestOptAdd(&hopt, "vi", "nin", airTypeOther, 1, 1, &nin, NULL, "input values", NULL,
+ NULL, nrrdHestNrrdNoTTY);
+ hestOptAdd(&hopt, "pi", "lpld", airTypeOther, 1, 1, &pld, NULL, "input polydata", NULL,
+ NULL, limnHestPolyDataLMPD);
hestOptAdd(&hopt, "th", "thresh", airTypeDouble, 1, 1, &thresh, NULL,
"threshold value");
hestOptAdd(&hopt, "o", "output LMPD", airTypeString, 1, 1, &outS, "out.lmpd",
"output file to save LMPD into");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
mop = airMopNew();
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
@@ -56,22 +53,22 @@
bitflag = limnPolyDataInfoBitFlag(pld);
fprintf(stderr, "!%s: bitflag = %d\n", me, bitflag);
fprintf(stderr, "!%s: rgba %d, norm %d, tex2 %d\n", me,
- (1 << limnPolyDataInfoRGBA) & bitflag,
- (1 << limnPolyDataInfoNorm) & bitflag,
+ (1 << limnPolyDataInfoRGBA) & bitflag, (1 << limnPolyDataInfoNorm) & bitflag,
(1 << limnPolyDataInfoTex2) & bitflag);
file = airFopen(outS, stdout, "w");
if (!file) {
fprintf(stderr, "%s: couldn't open \"%s\" for writing", me, outS);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopAdd(mop, file, (airMopper)airFclose, airMopAlways);
- if (limnPolyDataClip(pld, nin, thresh)
- || limnPolyDataWriteLMPD(file, pld)) {
+ if (limnPolyDataClip(pld, nin, thresh) || limnPolyDataWriteLMPD(file, pld)) {
airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopOkay(mop);
Modified: teem/trunk/src/limn/test/off2eps.c
===================================================================
--- teem/trunk/src/limn/test/off2eps.c 2024-07-23 16:51:37 UTC (rev 7224)
+++ teem/trunk/src/limn/test/off2eps.c 2024-07-23 16:52:53 UTC (rev 7225)
@@ -19,7 +19,6 @@
Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "../limn.h"
const char *info = ("Renders an OFF file to an EPS file.");
@@ -30,7 +29,7 @@
char *err, *inS, *outS;
limnCamera *cam;
float bg[3], winscale, edgeWidth[5], creaseAngle;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
limnObject *obj;
limnWindow *win;
@@ -43,9 +42,8 @@
airMopAdd(mop, cam, (airMopper)limnCameraNix, airMopAlways);
me = argv[0];
- hestOptAdd(&hopt, "i", "input OFF", airTypeString, 1, 1, &inS, NULL,
- "input OFF file");
- hestOptAdd(&hopt, "fr", "from point", airTypeDouble, 3, 3, cam->from,"4 4 4",
+ hestOptAdd(&hopt, "i", "input OFF", airTypeString, 1, 1, &inS, NULL, "input OFF file");
+ hestOptAdd(&hopt, "fr", "from point", airTypeDouble, 3, 3, cam->from, "4 4 4",
"position of camera, used to determine view vector");
hestOptAdd(&hopt, "at", "at point", airTypeDouble, 3, 3, cam->at, "0 0 0",
"camera look-at point, used to determine view vector");
@@ -55,15 +53,14 @@
"use a right-handed UVN frame (V points down)");
hestOptAdd(&hopt, "or", NULL, airTypeInt, 0, 0, &(cam->orthographic), NULL,
"use orthogonal projection");
- hestOptAdd(&hopt, "ur", "uMin uMax", airTypeDouble, 2, 2, cam->uRange,
- "-1 1", "range in U direction of image plane");
- hestOptAdd(&hopt, "vr", "vMin vMax", airTypeDouble, 2, 2, cam->vRange,
- "-1 1", "range in V direction of image plane");
+ hestOptAdd(&hopt, "ur", "uMin uMax", airTypeDouble, 2, 2, cam->uRange, "-1 1",
+ "range in U direction of image plane");
+ hestOptAdd(&hopt, "vr", "vMin vMax", airTypeDouble, 2, 2, cam->vRange, "-1 1",
+ "range in V direction of image plane");
hestOptAdd(&hopt, "e", "envmap", airTypeOther, 1, 1, &nmap, "",
- "16octa-based environment map",
- NULL, NULL, nrrdHestNrrd);
- hestOptAdd(&hopt, "ws", "winscale", airTypeFloat, 1, 1, &winscale,
- "200", "world to points (PostScript) scaling");
+ "16octa-based environment map", NULL, NULL, nrrdHestNrrdNoTTY);
+ hestOptAdd(&hopt, "ws", "winscale", airTypeFloat, 1, 1, &winscale, "200",
+ "world to points (PostScript) scaling");
hestOptAdd(&hopt, "wire", NULL, airTypeInt, 0, 0, &wire, NULL,
"just do wire-frame rendering");
hestOptAdd(&hopt, "concave", NULL, airTypeInt, 0, 0, &concave, NULL,
@@ -87,8 +84,7 @@
"dihedral angles greater than this are creases");
hestOptAdd(&hopt, "o", "output PS", airTypeString, 1, 1, &outS, "out.ps",
"output file to render postscript into");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
@@ -107,13 +103,15 @@
airMopAdd(mop, obj, (airMopper)limnObjectNix, airMopAlways);
if (!(file = airFopen(inS, stdin, "r"))) {
fprintf(stderr, "%s: couldn't open \"%s\" for reading\n", me, inS);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
airMopAdd(mop, file, (airMopper)airFclose, airMopAlways);
if (limnObjectReadOFF(obj, file)) {
airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (describe) {
fprintf(stdout, "----------------- POST-READ -----------------\n");
@@ -124,7 +122,8 @@
if (limnObjectFaceReverse(obj)) {
airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
if (describe) {
@@ -149,12 +148,12 @@
win->scale = winscale;
if (limnObjectRender(obj, cam, win)
- || (concave
- ? limnObjectPSDrawConcave(obj, cam, nmap, win)
- : limnObjectPSDraw(obj, cam, nmap, win))) {
+ || (concave ? limnObjectPSDrawConcave(obj, cam, nmap, win)
+ : limnObjectPSDraw(obj, cam, nmap, win))) {
airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
fclose(win->file);
@@ -167,4 +166,3 @@
airMopOkay(mop);
return 0;
}
-
Modified: teem/trunk/src/limn/test/tbc.c
===================================================================
--- teem/trunk/src/limn/test/tbc.c 2024-07-23 16:51:37 UTC (rev 7224)
+++ teem/trunk/src/limn/test/tbc.c 2024-07-23 16:52:53 UTC (rev 7225)
@@ -19,7 +19,6 @@
Fifth Floor, Boston, MA 02110-1301 USA
*/
-
/*
test/tbc -s 0.95 -i s.txt -loop -n 13 -m 800 -t 55 170 > ! out.ps
*/
@@ -43,7 +42,6 @@
0 -10
*/
-
#include "../limn.h"
const char *info = ("Visualize the space of BC cubics with a spline.");
@@ -53,7 +51,7 @@
const char *me;
char *err;
limnSpline *spline;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
int bi, ci, i, N, M, loop;
Nrrd *ncptA, *ncptB, *nout;
@@ -64,8 +62,8 @@
me = argv[0];
hestOptAdd(&hopt, "i", "spline data", airTypeOther, 1, 1, &ncptA, NULL,
- "data points for the spline, must be 2-vectors",
- NULL, NULL, nrrdHestNrrd);
+ "data points for the spline, must be 2-vectors", NULL, NULL,
+ nrrdHestNrrdNoTTY);
hestOptAdd(&hopt, "loop", NULL, airTypeInt, 0, 0, &loop, NULL,
"the last control point is in fact the first");
hestOptAdd(&hopt, "n", "N", airTypeInt, 1, 1, &N, "10",
@@ -76,22 +74,20 @@
"translation for drawing");
hestOptAdd(&hopt, "s", "scale", airTypeDouble, 1, 1, &scale, "1.0",
"scaling for drawing");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
- if (!( 2 == ncptA->dim && 2 == ncptA->axis[0].size )) {
+ if (!(2 == ncptA->dim && 2 == ncptA->axis[0].size)) {
fprintf(stderr, "%s: didn't get a 2-D 2xN nrrd)\n", me);
airMopError(mop);
return 1;
}
spec = limnSplineTypeSpecNew(limnSplineTypeBC, 0, 0);
- airMopAdd(mop, ncptB=nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
- if (limnSplineNrrdCleverFix(ncptB, ncptA, limnSplineInfo2Vector,
- limnSplineTypeBC)
+ airMopAdd(mop, ncptB = nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
+ if (limnSplineNrrdCleverFix(ncptB, ncptA, limnSplineInfo2Vector, limnSplineTypeBC)
|| !(spline = limnSplineNew(ncptB, limnSplineInfo2Vector, spec))) {
- airMopAdd(mop, err=biffGetDone(LIMN), airFree, airMopAlways);
+ airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
airMopError(mop);
return 1;
@@ -98,13 +94,13 @@
}
spline->loop = loop;
airMopAdd(mop, spline, (airMopper)limnSplineNix, airMopAlways);
- airMopAdd(mop, nout=nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
+ airMopAdd(mop, nout = nrrdNew(), (airMopper)nrrdNuke, airMopAlways);
minT = limnSplineMinT(spline);
maxT = limnSplineMaxT(spline);
/* try one for error checking */
if (limnSplineSample(nout, spline, minT, M, maxT)) {
- airMopAdd(mop, err=biffGetDone(LIMN), airFree, airMopAlways);
+ airMopAdd(mop, err = biffGetDone(LIMN), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s\n", me, err);
airMopError(mop);
return 1;
@@ -114,21 +110,21 @@
printf("1 setlinewidth\n");
printf("%g %g translate\n", tran[0], tran[1]);
- for (ci=0; ci<N; ci++) {
- C = AIR_AFFINE(0, ci, N-1, 0.0, 1.0);
- for (bi=0; bi<N; bi++) {
- B = AIR_AFFINE(0, bi, N-1, 0.0, 1.0);
+ for (ci = 0; ci < N; ci++) {
+ C = AIR_AFFINE(0, ci, N - 1, 0.0, 1.0);
+ for (bi = 0; bi < N; bi++) {
+ B = AIR_AFFINE(0, bi, N - 1, 0.0, 1.0);
limnSplineBCSet(spline, B, C);
limnSplineSample(nout, spline, minT, M, maxT);
- out = (double*)(nout->data); /* shouldn't actually change */
+ out = (double *)(nout->data); /* shouldn't actually change */
printf("gsave\n");
- printf("%g %g translate\n", bi*500.0/(N-1), ci*500.0/(N-1));
+ printf("%g %g translate\n", bi * 500.0 / (N - 1), ci * 500.0 / (N - 1));
printf("%g %g scale\n", scale, scale);
- printf("%g %g moveto\n", out[0 + 2*0], out[1 + 2*0]);
- for (i=1; i<M; i++) {
- printf("%g %g lineto\n", out[0 + 2*i], out[1 + 2*i]);
+ printf("%g %g moveto\n", out[0 + 2 * 0], out[1 + 2 * 0]);
+ for (i = 1; i < M; i++) {
+ printf("%g %g lineto\n", out[0 + 2 * i], out[1 + 2 * i]);
}
if (spline->loop) {
printf("closepath\n");
@@ -144,4 +140,3 @@
airMopOkay(mop);
return 0;
}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-23 16:51:38
|
Revision: 7224
http://sourceforge.net/p/teem/code/7224
Author: kindlmann
Date: 2024-07-23 16:51:37 +0000 (Tue, 23 Jul 2024)
Log Message:
-----------
reformatting/clarifying comment
Modified Paths:
--------------
teem/trunk/src/air/array.c
Modified: teem/trunk/src/air/array.c
===================================================================
--- teem/trunk/src/air/array.c 2024-07-23 16:40:49 UTC (rev 7223)
+++ teem/trunk/src/air/array.c 2024-07-23 16:51:37 UTC (rev 7224)
@@ -186,17 +186,14 @@
**
** Set the length of the array, allocating or freeing as needed
**
-** returns 1 on error, otherwise 0 if okay
-** possible errors: bogus arguments, or couldn't allocate new memory segment
-**
** In case we can't allocate the new space, the old space is left untouched,
** however if the new length is smaller, the free/done callbacks will
** have been called on invalidated elements
**
-** NB: this used to have a "boolean" return to indicate allocation
-** error, but almost nothing in Teem actually did the error checking.
-** Now conscientious users can look at NULL-ity of a->data to detect
-** such an error.
+** NB: this used to have a "boolean" return to indicate allocation error, but almost
+** nothing in Teem actually did the error checking. Now conscientious users can look at
+** NULL-ity of a->data to detect such an error (e.g. bogus arguments, or couldn't
+** allocate new memory segment)
*/
void
airArrayLenSet(airArray *a, unsigned int newlen) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-23 16:40:53
|
Revision: 7223
http://sourceforge.net/p/teem/code/7223
Author: kindlmann
Date: 2024-07-23 16:40:49 +0000 (Tue, 23 Jul 2024)
Log Message:
-----------
clang format, and using nrrdHestNrrdNoTTY
Modified Paths:
--------------
teem/trunk/src/coil/test/coiler.c
Modified: teem/trunk/src/coil/test/coiler.c
===================================================================
--- teem/trunk/src/coil/test/coiler.c 2024-07-17 19:30:41 UTC (rev 7222)
+++ teem/trunk/src/coil/test/coiler.c 2024-07-23 16:40:49 UTC (rev 7223)
@@ -19,7 +19,6 @@
Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "../coil.h"
const char *info = ("Test program for coil library.");
@@ -28,11 +27,10 @@
main(int argc, const char *argv[]) {
const char *me;
char *err, *outS;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
airArray *mop;
- int numIters, numThreads, methodType, kindType, _parmLen, pi, radius,
- verbose;
+ int numIters, numThreads, methodType, kindType, _parmLen, pi, radius, verbose;
Nrrd *nin, *nout;
coilContext *cctx;
double *_parm, parm[COIL_PARMS_NUM];
@@ -51,14 +49,12 @@
"all the parameters required for filtering method", &_parmLen);
hestOptAdd(&hopt, "r", "radius", airTypeInt, 1, 1, &radius, "1",
"radius of filtering neighborhood");
- hestOptAdd(&hopt, "v", "verbose", airTypeInt, 1, 1, &verbose, "1",
- "verbosity level");
- hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &(nin), "",
- "input volume to filter", NULL, NULL, nrrdHestNrrd);
+ hestOptAdd(&hopt, "v", "verbose", airTypeInt, 1, 1, &verbose, "1", "verbosity level");
+ hestOptAdd(&hopt, "i", "nin", airTypeOther, 1, 1, &(nin), "", "input volume to filter",
+ NULL, NULL, nrrdHestNrrdNoTTY);
hestOptAdd(&hopt, "o", "nout", airTypeString, 1, 1, &outS, "-",
"output file to save filtering result into");
- hestParseOrDie(hopt, argc-1, argv+1, NULL,
- me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestParseOrDie(hopt, argc - 1, argv + 1, NULL, me, info, AIR_TRUE, AIR_TRUE, AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
@@ -69,21 +65,17 @@
if (_parmLen != coilMethodArray[methodType]->numParm) {
fprintf(stderr, "%s: %s method wants %d parms, but got %d\n", me,
- coilMethodArray[methodType]->name,
- coilMethodArray[methodType]->numParm, _parmLen);
+ coilMethodArray[methodType]->name, coilMethodArray[methodType]->numParm,
+ _parmLen);
airMopError(mop);
return 1;
}
- for (pi=0; pi<_parmLen; pi++) {
+ for (pi = 0; pi < _parmLen; pi++) {
parm[pi] = _parm[pi];
}
- if (coilContextAllSet(cctx, nin,
- coilKindArray[kindType], coilMethodArray[methodType],
- radius, numThreads, verbose,
- parm)
- || coilStart(cctx)
- || coilIterate(cctx, numIters)
- || coilFinish(cctx)
+ if (coilContextAllSet(cctx, nin, coilKindArray[kindType], coilMethodArray[methodType],
+ radius, numThreads, verbose, parm)
+ || coilStart(cctx) || coilIterate(cctx, numIters) || coilFinish(cctx)
|| coilOutputGet(nout, cctx)) {
airMopAdd(mop, err = biffGetDone(COIL), airFree, airMopAlways);
fprintf(stderr, "%s: trouble with coil:\n%s\n", me, err);
@@ -99,4 +91,3 @@
airMopOkay(mop);
return 0;
}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-17 19:30:43
|
Revision: 7222
http://sourceforge.net/p/teem/code/7222
Author: kindlmann
Date: 2024-07-17 19:30:41 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
biffMovef didnt free messages at source key -> memory leak
Modified Paths:
--------------
teem/trunk/src/biff/biffbiff.c
Modified: teem/trunk/src/biff/biffbiff.c
===================================================================
--- teem/trunk/src/biff/biffbiff.c 2024-07-17 19:03:34 UTC (rev 7221)
+++ teem/trunk/src/biff/biffbiff.c 2024-07-17 19:30:41 UTC (rev 7222)
@@ -422,6 +422,7 @@
return;
}
_biffMsgMoveVL(dest, src, errfmt, args);
+ biffDone(srcKey);
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-17 19:03:37
|
Revision: 7221
http://sourceforge.net/p/teem/code/7221
Author: kindlmann
Date: 2024-07-17 19:03:34 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
clarifying comment; trying to fix memory error
Modified Paths:
--------------
teem/trunk/src/limn/limn.h
teem/trunk/src/limn/splineFit.c
Modified: teem/trunk/src/limn/limn.h
===================================================================
--- teem/trunk/src/limn/limn.h 2024-07-17 18:03:54 UTC (rev 7220)
+++ teem/trunk/src/limn/limn.h 2024-07-17 19:03:34 UTC (rev 7221)
@@ -522,10 +522,11 @@
double xy[8]; /* four control points of cubic Bezier:
x0, y0, x1, y1, x2, y2, x3, y3
0 1 2 3 4 5 6 7 DIM=2 */
- int corner[2]; /* corner[0,1] non-zero if xy[0,3] are either corner vertices
- or path-ending vertices, i.e. reasons to not have geometric
- continuity here, either because we intend to have a corner,
- or because there's nothing else to be continuous with */
+ int corner[2]; /* corner[0] is non-zero if vertex xy[0,1] is either a corner vertex
+ or a path-ending vertex, i.e. reasons to NOT have geometric
+ continuity there, either because we intend to have a corner,
+ or because there's nothing else to be continuous with.
+ corner[1] describes the same for xy[6,7]. */
/* how many points does this represent */
unsigned int pointNum;
} limnCbfSeg;
Modified: teem/trunk/src/limn/splineFit.c
===================================================================
--- teem/trunk/src/limn/splineFit.c 2024-07-17 18:03:54 UTC (rev 7220)
+++ teem/trunk/src/limn/splineFit.c 2024-07-17 19:03:34 UTC (rev 7221)
@@ -284,6 +284,7 @@
limnCbfPath *path;
path = AIR_MALLOC(1, limnCbfPath);
if (path) {
+ path->seg = NULL;
path->segArr = airArrayNew((void **)(&path->seg), &path->segNum, sizeof(limnCbfSeg),
128 /* incr */);
airArrayStructCB(path->segArr, segInit, NULL);
@@ -290,7 +291,7 @@
path->isLoop = AIR_FALSE;
if (segNum) {
airArrayLenSet(path->segArr, segNum);
- if (!path->segArr->data) {
+ if (!path->seg) {
/* whoa, couldn't allocate requested segments; return NULL and possibly leak */
path = NULL;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-17 18:04:01
|
Revision: 7220
http://sourceforge.net/p/teem/code/7220
Author: kindlmann
Date: 2024-07-17 18:03:54 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
fixing uses of AIR_STRLEN_x plus clang-format
Modified Paths:
--------------
teem/trunk/src/bin/CMakeLists.txt
teem/trunk/src/bin/airSanity.c
teem/trunk/src/bin/gprobe.c
teem/trunk/src/bin/ilk.c
teem/trunk/src/bin/miter.c
teem/trunk/src/bin/nrrdSanity.c
teem/trunk/src/bin/pprobe.c
teem/trunk/src/bin/puller-with-Deft.c
teem/trunk/src/bin/qbert.c
teem/trunk/src/bin/talkweb.c
teem/trunk/src/bin/tend.c
teem/trunk/src/bin/unu.c
teem/trunk/src/bin/vprobe.c
Modified: teem/trunk/src/bin/CMakeLists.txt
===================================================================
--- teem/trunk/src/bin/CMakeLists.txt 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/CMakeLists.txt 2024-07-17 18:03:54 UTC (rev 7220)
@@ -43,24 +43,27 @@
CREATE_EXEC(puller puller.c)
CREATE_EXEC(tend tend.c)
-# For Teem v2 many of these were removed from compilation: they have no compelling
-# general purpose, for reasons indicated with further comments. No reason
-# to delete the sources though.
-# NOTE: The BUILD_EXPERIMENTAL_LIBS-dependent inclusion of binaries has to be
-# done with knowledge of how BUILD_EXPERIMENTAL_LIBS behaves in the top-level
-# CMakeLists.txt file
-if(BUILD_EXPERIMENTAL_APPS)
+### For Teem v2, these were removed from compilation: they have no compelling
+### general purpose, for reasons indicated with further comments. No reason
+### to delete the sources though; they can still be compiled by other means.
+##
+## NOTE: The BUILD_EXPERIMENTAL_LIBS-dependent inclusion of binaries has to be
+## done with knowledge of how BUILD_EXPERIMENTAL_LIBS behaves in the top-level
+## CMakeLists.txt file
+# if(BUILD_EXPERIMENTAL_APPS)
# CREATE_EXEC(airSanity airSanity.c) # tests included in nrrdSanity
# CREATE_EXEC(cubic cubic.c) # just calls ell_cubic; more easily done via Python wrappers
# CREATE_EXEC(qbert qbert.c) # created for volume rendering on GPUs from 20 years ago
# CREATE_EXEC(ilk ilk.c) # now part of unu: "unu ilk"
- CREATE_EXEC(emap emap.c) # (functionality not currently handled elsewhere)
+# CREATE_EXEC(emap emap.c) # functionality not currently handled elsewhere,
+# but nor is it is really needed for anything
# CREATE_EXEC(talkweb talkweb.c) # the web has changed in 20 years
# CREATE_EXEC(pprobe pprobe.c) # gprobe can do this
# CREATE_EXEC(ungantry ungantry.c) # gprobe can do this
- CREATE_EXEC(deconv deconv.c) # (functionality not currently handled elsewhere)
+# CREATE_EXEC(deconv deconv.c) # functionality not currently handled elsewhere,
+# but nor is it is really needed for anything
# if(BUILD_EXPERIMENTAL_LIBS)
# CREATE_EXEC(gkms gkms.c) # hasn't been tested in a long time
# CREATE_EXEC(spots spots.c) # hasn't been tested in a long time
# endif()
-endif()
+# endif()
Modified: teem/trunk/src/bin/airSanity.c
===================================================================
--- teem/trunk/src/bin/airSanity.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/airSanity.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -30,7 +30,7 @@
me = argv[0];
aret = airSanity();
if (airInsane_not == aret) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
fprintf(stderr, "%s: air sanity check passed.\n", me);
fprintf(stderr, "\n");
fprintf(stderr, "airMyEndian() == %d\n", airMyEndian());
Modified: teem/trunk/src/bin/gprobe.c
===================================================================
--- teem/trunk/src/bin/gprobe.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/gprobe.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -53,7 +53,7 @@
unsigned int ansLen, dim, aidx, baseDim, gridDim;
size_t sizeOut[NRRD_DIM_MAX], coordOut[NRRD_DIM_MAX], II, NN;
double (*ins)(void *v, size_t I, double d);
- char stmp[2][AIR_STRLEN_SMALL];
+ char stmp[2][AIR_STRLEN_SMALL + 1];
if (!(ctx && pvl && nout && _ngrid)) {
biffAddf(GAGE, "%s: got NULL pointer", me);
@@ -239,7 +239,7 @@
unsigned int ansLen, *skip, skipNum, pntPosNum, nonSbpOpi[NON_SBP_OPT_NUM], nsi;
gageStackBlurParm *sbpIN, *sbpCL, *sbp;
int otype, clamp, scaleIsTau;
- char stmp[4][AIR_STRLEN_SMALL];
+ char stmp[4][AIR_STRLEN_SMALL + 1];
me = argv[0];
/* parse environment variables first, in case they break nrrdDefault*
Modified: teem/trunk/src/bin/ilk.c
===================================================================
--- teem/trunk/src/bin/ilk.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/ilk.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -144,7 +144,7 @@
ELL_2V_COPY(msp->verbPixel, debug);
if (nrrdBoundaryPad == bound) {
if (_bkgLen != MOSS_CHAN_NUM(nin)) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
fprintf(stderr, "%s: got length %u background, image has %s channels\n", me,
_bkgLen, airSprintSize_t(stmp, MOSS_CHAN_NUM(nin)));
airMopError(mop);
Modified: teem/trunk/src/bin/miter.c
===================================================================
--- teem/trunk/src/bin/miter.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/miter.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -36,7 +36,7 @@
hestParm *hparm = NULL;
miteUser *muu;
const char *me;
- char *errS, *outS, *shadeStr, *normalStr, debugStr[AIR_STRLEN_MED];
+ char *errS, *outS, *shadeStr, *normalStr, debugStr[AIR_STRLEN_MED + 1];
int renorm, baseDim, verbPix[2], offfr;
int E, Ecode, Ethread;
float ads[3], isScale;
@@ -206,8 +206,8 @@
fprintf(stderr, " N = {%g,%g,%g}\n",
muu->hctx->cam->N[0], muu->hctx->cam->N[1], muu->hctx->cam->N[2]);
*/
- airStrcpy(muu->shadeStr, AIR_STRLEN_MED, shadeStr);
- airStrcpy(muu->normalStr, AIR_STRLEN_MED, normalStr);
+ airStrcpy(muu->shadeStr, AIR_STRLEN_MED + 1, shadeStr);
+ airStrcpy(muu->normalStr, AIR_STRLEN_MED + 1, normalStr);
if (0) {
muu->hctx->volSize[0] = nin->axis[baseDim + 0].size;
muu->hctx->volSize[1] = nin->axis[baseDim + 1].size;
Modified: teem/trunk/src/bin/nrrdSanity.c
===================================================================
--- teem/trunk/src/bin/nrrdSanity.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/nrrdSanity.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -30,7 +30,7 @@
me = argv[0];
if (2 == argc) {
if (!strcmp(argv[1], "--version")) {
- char vbuff[AIR_STRLEN_LARGE];
+ char vbuff[AIR_STRLEN_LARGE + 1];
airTeemVersionSprint(vbuff);
printf("%s\n", vbuff);
exit(0);
Modified: teem/trunk/src/bin/pprobe.c
===================================================================
--- teem/trunk/src/bin/pprobe.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/pprobe.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -230,7 +230,7 @@
return 1;
}
if (airStrlen(stackSavePath)) {
- char fnform[AIR_STRLEN_LARGE];
+ char fnform[AIR_STRLEN_LARGE + 1];
sprintf(fnform, "%s/blur-%%02u.nrrd", stackSavePath);
fprintf(stderr, "%s: |%s|\n", me, fnform);
if (nrrdSaveMulti(fnform, AIR_CAST(const Nrrd *const *, ninSS), numSS, 0, NULL)) {
Modified: teem/trunk/src/bin/puller-with-Deft.c
===================================================================
--- teem/trunk/src/bin/puller-with-Deft.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/puller-with-Deft.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -1619,7 +1619,7 @@
nrrdSave(outS, nPosOut, NULL);
if (airStrlen(extraOutBaseS)) {
Nrrd *nstrn, *nstab, *nintern;
- char fname[3][AIR_STRLEN_MED];
+ char fname[3][AIR_STRLEN_MED + 1];
nstrn = nrrdNew();
nstab = nrrdNew();
nintern = nrrdNew();
Modified: teem/trunk/src/bin/qbert.c
===================================================================
--- teem/trunk/src/bin/qbert.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/qbert.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -87,7 +87,7 @@
}
} else {
for (i = 0; i <= 2; i++) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
anyneed |= !!(need = AIR_INT(sz[i]) - AIR_INT(nin->axis[i].size));
fprintf(stderr, "%s: sz[%d] = %s -> need = %d --> ", me, i,
airSprintSize_t(stmp, nin->axis[i].size), need);
@@ -143,7 +143,7 @@
need = 0;
for (i = 0; i <= 2; i++) {
if (nin->axis[i].size > sz[i]) {
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp1[AIR_STRLEN_SMALL + 1], stmp2[AIR_STRLEN_SMALL + 1];
need = 1;
rsi->kernel[i] = dk->kernel;
memcpy(rsi->parm[i], dk->parm, dk->kernel->numParm * sizeof(double));
@@ -196,7 +196,7 @@
qbertProbe(Nrrd *nout, Nrrd *nin, NrrdKernelSpec *k00, NrrdKernelSpec *k11,
NrrdKernelSpec *k22, int doH, unsigned int *sz) {
static const char me[] = "qbertProbe";
- char prog[AIR_STRLEN_SMALL];
+ char prog[AIR_STRLEN_SMALL + 1];
gageContext *ctx;
gagePerVolume *pvl;
const double *val, *gmag, *scnd;
@@ -390,7 +390,7 @@
qbertMakeVgh(Nrrd *nvgh, Nrrd *nvhist, Nrrd *nghist, Nrrd *nhhist, unsigned int *sz,
float *perc, Nrrd *nvghF) {
static const char me[] = "qbertMakeVgh";
- char cmt[AIR_STRLEN_SMALL];
+ char cmt[AIR_STRLEN_SMALL + 1];
double minv, maxv, ming, maxg, minh = 0, maxh = 0;
int lose, *vhist, *ghist, *hhist = NULL, vi, gi, hi, doH;
unsigned int i, nval, bins;
Modified: teem/trunk/src/bin/talkweb.c
===================================================================
--- teem/trunk/src/bin/talkweb.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/talkweb.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -93,7 +93,7 @@
int
tkwbReadFileToString(char **strP, int *hitEOF, FILE *file, char *stop) {
- char **all, line[AIR_STRLEN_HUGE];
+ char **all, line[AIR_STRLEN_HUGE + 1];
airArray *allArr;
unsigned int allLen;
unsigned int lineLen, lineIdx, totalLen;
@@ -102,7 +102,7 @@
uu.pc = &all;
allArr = airArrayNew(uu.v, &allLen, sizeof(char *), tkwbArrayIncr);
airArrayPointerCB(allArr, airNull, airFree);
- lineLen = airOneLine(file, line, AIR_STRLEN_HUGE);
+ lineLen = airOneLine(file, line, AIR_STRLEN_HUGE + 1);
totalLen = 0;
while (lineLen && (!(airStrlen(stop) && !strcmp(line, stop)))) {
lineIdx = airArrayLenIncr(allArr, 1); /* HEY error checking */
@@ -109,7 +109,7 @@
all[lineIdx] = (char *)calloc(strlen(line) + strlen("\n") + 1, sizeof(char));
sprintf(all[lineIdx], "%s\n", line);
totalLen += strlen(line) + 1;
- lineLen = airOneLine(file, line, AIR_STRLEN_HUGE);
+ lineLen = airOneLine(file, line, AIR_STRLEN_HUGE + 1);
}
if (hitEOF) {
*hitEOF = !lineLen;
@@ -155,7 +155,7 @@
FILE *file;
airArray *mop, *slideArr;
tkwbSlide **slide = NULL;
- char *title, *image, *text, stop[AIR_STRLEN_HUGE], line[AIR_STRLEN_HUGE];
+ char *title, *image, *text, stop[AIR_STRLEN_HUGE + 1], line[AIR_STRLEN_HUGE + 1];
int slideIdx = 0, hitEOF, notReally;
unsigned int len;
_tkwbU uu;
@@ -168,7 +168,7 @@
}
airMopAdd(mop, file, (airMopper)airFclose, airMopAlways);
- len = airOneLine(file, stop, AIR_STRLEN_HUGE);
+ len = airOneLine(file, stop, AIR_STRLEN_HUGE + 1);
if (!(len > 1)) {
biffAddf(TKWB, "%s: didn't get a stop delimiter from %s", me, filename);
airMopError(mop);
@@ -181,7 +181,7 @@
hitEOF = notReally = AIR_FALSE;
while (!hitEOF) {
slideIdx = airArrayLenIncr(slideArr, 1); /* HEY error checking */
- len = airOneLine(file, line, AIR_STRLEN_HUGE);
+ len = airOneLine(file, line, AIR_STRLEN_HUGE + 1);
if (!len) {
/* got EOF after a division marker, that's okay */
notReally = AIR_TRUE;
@@ -188,7 +188,7 @@
break;
}
title = airStrdup(line);
- len = airOneLine(file, line, AIR_STRLEN_HUGE);
+ len = airOneLine(file, line, AIR_STRLEN_HUGE + 1);
if (!len) {
break;
}
@@ -322,7 +322,7 @@
int
tkwbWriteIndex(char *_indx, tkwbSlide **slide, char *tag[TKWB_TAG_MAX + 1]) {
static const char me[] = "tkwbWriteIndex";
- char *repl, *indx, tmp[AIR_STRLEN_MED];
+ char *repl, *indx, tmp[AIR_STRLEN_MED + 1];
int replLen, si;
airArray *mop;
@@ -366,8 +366,8 @@
tkwbWriteSlides(tkwbSlide **slide, int numSlides, char *tmpl,
char *tag[TKWB_TAG_MAX + 1], char *link[4]) {
static const char me[] = "tkwbWriteSlides";
- char *text, name[AIR_STRLEN_MED], frst[AIR_STRLEN_MED], prev[AIR_STRLEN_MED],
- next[AIR_STRLEN_MED], last[AIR_STRLEN_MED];
+ char *text, name[AIR_STRLEN_MED + 1], frst[AIR_STRLEN_MED + 1],
+ prev[AIR_STRLEN_MED + 1], next[AIR_STRLEN_MED + 1], last[AIR_STRLEN_MED + 1];
int si;
airArray *mop;
@@ -460,8 +460,8 @@
int
main(int argc, const char *argv[]) {
const char *me;
- char *err, *indxS, *tmplS, *scriptS, *pretag[TKWB_TAG_MAX + 1], *tag[AIR_STRLEN_MED],
- *frstLink, *prevLink, *nextLink, *lastLink, *link[4];
+ char *err, *indxS, *tmplS, *scriptS, *pretag[TKWB_TAG_MAX + 1],
+ *tag[AIR_STRLEN_MED + 1], *frstLink, *prevLink, *nextLink, *lastLink, *link[4];
hestOpt *hopt = NULL;
airArray *mop;
int ti;
Modified: teem/trunk/src/bin/tend.c
===================================================================
--- teem/trunk/src/bin/tend.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/tend.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -65,7 +65,7 @@
}
/* else, we see if its --version */
if (!strcmp("--version", argv[1])) {
- char vbuff[AIR_STRLEN_LARGE];
+ char vbuff[AIR_STRLEN_LARGE + 1];
airTeemVersionSprint(vbuff);
printf("%s\n", vbuff);
exit(0);
Modified: teem/trunk/src/bin/unu.c
===================================================================
--- teem/trunk/src/bin/unu.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/unu.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -84,7 +84,7 @@
}
/* else, we see if its unu --version */
if (!strcmp("--version", argv[1])) {
- char vbuff[AIR_STRLEN_LARGE];
+ char vbuff[AIR_STRLEN_LARGE + 1];
airTeemVersionSprint(vbuff);
printf("%s\n", vbuff);
exit(0);
Modified: teem/trunk/src/bin/vprobe.c
===================================================================
--- teem/trunk/src/bin/vprobe.c 2024-07-17 17:58:04 UTC (rev 7219)
+++ teem/trunk/src/bin/vprobe.c 2024-07-17 18:03:54 UTC (rev 7220)
@@ -61,7 +61,7 @@
char hackKeyStr[] = "TEEM_VPROBE_HACK_ZI", *hackValStr;
int otype, hackSet;
- char stmp[4][AIR_STRLEN_SMALL];
+ char stmp[4][AIR_STRLEN_SMALL + 1];
me = argv[0];
/* parse environment variables first, in case they break nrrdDefault*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-17 17:58:08
|
Revision: 7219
http://sourceforge.net/p/teem/code/7219
Author: kindlmann
Date: 2024-07-17 17:58:04 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
fixing uses of AIR_STRLEN_x plus clang-format
Modified Paths:
--------------
teem/trunk/Testing/meet/buildinfo.c
teem/trunk/Testing/meet/probeSS.c
Modified: teem/trunk/Testing/meet/buildinfo.c
===================================================================
--- teem/trunk/Testing/meet/buildinfo.c 2024-07-17 17:55:33 UTC (rev 7218)
+++ teem/trunk/Testing/meet/buildinfo.c 2024-07-17 17:58:04 UTC (rev 7219)
@@ -44,7 +44,7 @@
char expapps[] = "_off_";
#endif
- char stmp1[AIR_STRLEN_SMALL], stmp2[AIR_STRLEN_SMALL];
+ char stmp1[AIR_STRLEN_SMALL + 1], stmp2[AIR_STRLEN_SMALL + 1];
AIR_UNUSED(argc);
AIR_UNUSED(argv);
@@ -55,7 +55,7 @@
printf("AIR_QNANHIBIT == %d\n", AIR_QNANHIBIT);
printf("sizeof(size_t) = %s; sizeof(void*) = %s\n",
airSprintSize_t(stmp1, sizeof(size_t)),
- airSprintSize_t(stmp2, sizeof(void*)));
+ airSprintSize_t(stmp2, sizeof(void *)));
printf("experimental libs %s; apps %s\n", explibs, expapps);
printf("libs = ");
Modified: teem/trunk/Testing/meet/probeSS.c
===================================================================
--- teem/trunk/Testing/meet/probeSS.c 2024-07-17 17:55:33 UTC (rev 7218)
+++ teem/trunk/Testing/meet/probeSS.c 2024-07-17 17:58:04 UTC (rev 7219)
@@ -85,7 +85,7 @@
static const char me[] = "engageGenTensor";
hestParm *hparm;
airArray *smop;
- char tmpStr[4][AIR_STRLEN_SMALL];
+ char tmpStr[4][AIR_STRLEN_SMALL + 1];
Nrrd *nclean;
NrrdIter *narg0, *narg1;
const char *helixArgv[] =
@@ -338,7 +338,7 @@
static const char me[] = "engageMopDiceVector";
gagePerVolume *pvl;
unsigned int ci;
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
if (!(4 == nvec->dim && 3 == nvec->axis[0].size)) {
biffAddf(BKEY, "%s: expected 4-D 3-by-X nrrd (not %u-D %s-by-X)", me, nvec->dim,
@@ -397,7 +397,7 @@
static const char me[] = "mopDiceDwi";
Nrrd **ndwiComp;
size_t dwiNum;
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
gagePerVolume *pvl;
unsigned int ci;
@@ -438,7 +438,7 @@
}
typedef struct {
- char name[AIR_STRLEN_SMALL];
+ char name[AIR_STRLEN_SMALL + 1];
const double **aptr; /* array of pointers to (const) answers */
gageItemSpec *ispec; /* array of gageItemSpecs (not pointers to them) */
unsigned int *alen; /* array of answer lengths */
@@ -466,7 +466,7 @@
multiAnswer *man;
man = AIR_CALLOC(1, multiAnswer);
- airStrcpy(man->name, AIR_STRLEN_SMALL, name);
+ airStrcpy(man->name, AIR_STRLEN_SMALL + 1, name);
multiAnswerInit(man);
return man;
}
@@ -887,9 +887,9 @@
airArray *mop;
const gageKind *kind[KIND_NUM];
- char name[KIND_NUM][AIR_STRLEN_SMALL] = {"scl", "vec", "ten", "dwi"};
- char nameComp[KIND_NUM][AIR_STRLEN_SMALL] = {"sclComp", "vecComp", "tenComp",
- "dwiComp"};
+ char name[KIND_NUM][AIR_STRLEN_SMALL + 1] = {"scl", "vec", "ten", "dwi"};
+ char nameComp[KIND_NUM][AIR_STRLEN_SMALL + 1] = {"sclComp", "vecComp", "tenComp",
+ "dwiComp"};
char *kernS;
gageKind *dwikind = NULL;
gageContext *gctxComp[KIND_NUM], *gctxCompCopy[KIND_NUM], *gctx[KIND_NUM],
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-17 17:55:37
|
Revision: 7218
http://sourceforge.net/p/teem/code/7218
Author: kindlmann
Date: 2024-07-17 17:55:33 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
fixing uses of AIR_STRLEN_x plus clang-format
Modified Paths:
--------------
teem/trunk/Testing/ten/glyphBqd.c
Modified: teem/trunk/Testing/ten/glyphBqd.c
===================================================================
--- teem/trunk/Testing/ten/glyphBqd.c 2024-07-17 17:54:47 UTC (rev 7217)
+++ teem/trunk/Testing/ten/glyphBqd.c 2024-07-17 17:55:33 UTC (rev 7218)
@@ -36,7 +36,7 @@
double *abc;
unsigned int sz, ui, vi, bi, betaMaxNum;
double uv[2], betaMax[2] = {2.5555555555, 3.888888888888};
- char *err, *refname, explain[AIR_STRLEN_LARGE];
+ char *err, *refname, explain[AIR_STRLEN_LARGE + 1];
int differ, ret;
mop = airMopNew();
@@ -43,23 +43,22 @@
nabc = nrrdNew();
airMopAdd(mop, nabc, (airMopper)nrrdNuke, airMopAlways);
sz = 100;
- betaMaxNum = AIR_CAST(unsigned int, sizeof(betaMax)/sizeof(double));
- if (nrrdMaybeAlloc_va(nabc, nrrdTypeDouble, 3,
- AIR_CAST(size_t, 3),
- AIR_CAST(size_t, sz),
- AIR_CAST(size_t, sz*betaMaxNum))) {
+ betaMaxNum = AIR_CAST(unsigned int, sizeof(betaMax) / sizeof(double));
+ if (nrrdMaybeAlloc_va(nabc, nrrdTypeDouble, 3, AIR_CAST(size_t, 3),
+ AIR_CAST(size_t, sz), AIR_CAST(size_t, sz * betaMaxNum))) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "trouble allocating:\n%s", err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
abc = AIR_CAST(double *, nabc->data);
- for (bi=0; bi<betaMaxNum; bi++) {
- for (vi=0; vi<sz; vi++) {
+ for (bi = 0; bi < betaMaxNum; bi++) {
+ for (vi = 0; vi < sz; vi++) {
uv[1] = NRRD_CELL_POS(0.0, 1.0, sz, vi);
- for (ui=0; ui<sz; ui++) {
+ for (ui = 0; ui < sz; ui++) {
uv[0] = NRRD_CELL_POS(0.0, 1.0, sz, ui);
- tenGlyphBqdAbcUv(abc + 3*(ui + sz*(vi + sz*bi)), uv, betaMax[bi]);
+ tenGlyphBqdAbcUv(abc + 3 * (ui + sz * (vi + sz * bi)), uv, betaMax[bi]);
}
}
}
@@ -69,11 +68,12 @@
nref = nrrdNew();
airMopAdd(mop, nref, (airMopper)nrrdNuke, airMopAlways);
if (nrrdLoad(nref, refname, NULL)
- || nrrdCompare(nref, nabc, AIR_FALSE /* onlyData */,
- 5e-15 /* epsilon */, &differ, explain)) {
+ || nrrdCompare(nref, nabc, AIR_FALSE /* onlyData */, 5e-15 /* epsilon */, &differ,
+ explain)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "trouble loading or comparing with ref:\n%s", err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (differ) {
@@ -83,8 +83,7 @@
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "oops, can't save generated array:\n%s", err);
} else {
- printf("%s: saved generated (and different) array as %s\n",
- argv[0], argv[1]);
+ printf("%s: saved generated (and different) array as %s\n", argv[0], argv[1]);
}
}
ret = 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-17 17:54:48
|
Revision: 7217
http://sourceforge.net/p/teem/code/7217
Author: kindlmann
Date: 2024-07-17 17:54:47 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
fixing uses of AIR_STRLEN_x plus clang-format
Modified Paths:
--------------
teem/trunk/Testing/gage/probeMulti.c
teem/trunk/Testing/gage/probeScl.c
teem/trunk/Testing/gage/tsbp.c
Modified: teem/trunk/Testing/gage/probeMulti.c
===================================================================
--- teem/trunk/Testing/gage/probeMulti.c 2024-07-17 17:53:02 UTC (rev 7216)
+++ teem/trunk/Testing/gage/probeMulti.c 2024-07-17 17:54:47 UTC (rev 7217)
@@ -30,21 +30,17 @@
*/
#define KERN_SIZE_MAX 10
-#define PROBE_NUM 300
+#define PROBE_NUM 300
static void
-errPrefix(char *dst,
- int typi, unsigned int supi, unsigned int prbi,
- unsigned int probePass, double dxi, double dyi, double dzi,
- unsigned int xi, unsigned int yi, unsigned int zi) {
- sprintf(dst, "%s[%s][%u] #%u pp %u: (%g,%g,%g)->(%u,%u,%u): ",
- "probeMulti",
- airEnumStr(nrrdType, typi), supi, prbi, probePass,
- dxi, dyi, dzi, xi, yi, zi);
+errPrefix(char *dst, int typi, unsigned int supi, unsigned int prbi,
+ unsigned int probePass, double dxi, double dyi, double dzi, unsigned int xi,
+ unsigned int yi, unsigned int zi) {
+ sprintf(dst, "%s[%s][%u] #%u pp %u: (%g,%g,%g)->(%u,%u,%u): ", "probeMulti",
+ airEnumStr(nrrdType, typi), supi, prbi, probePass, dxi, dyi, dzi, xi, yi, zi);
return;
}
-
int
main() {
airArray *mop, *submop;
@@ -51,29 +47,24 @@
char *err;
int typi;
- unsigned int supi, probePass, cti /* context copy index */,
- pvlIdx[NRRD_TYPE_MAX+1], sx, sy, sz, subnum;
- size_t sizes[3] = {42,61,50} /* one of these must be even */,
- ii, nn;
- Nrrd *norigScl, *nucharScl, *nunquant, *nqdiff,
- *nconvScl[NRRD_TYPE_MAX+1];
+ unsigned int supi, probePass, cti /* context copy index */, pvlIdx[NRRD_TYPE_MAX + 1],
+ sx, sy, sz, subnum;
+ size_t sizes[3] = {42, 61, 50} /* one of these must be even */, ii, nn;
+ Nrrd *norigScl, *nucharScl, *nunquant, *nqdiff, *nconvScl[NRRD_TYPE_MAX + 1];
unsigned char *ucharScl;
- gageContext *gctx[2][KERN_SIZE_MAX+1];
- gagePerVolume *gpvl[2][NRRD_TYPE_MAX+1][KERN_SIZE_MAX+1];
- const double *vansScl[2][NRRD_TYPE_MAX+1][KERN_SIZE_MAX+1],
- *gansScl[2][NRRD_TYPE_MAX+1][KERN_SIZE_MAX+1],
- *hansScl[2][NRRD_TYPE_MAX+1][KERN_SIZE_MAX+1];
- double *origScl, omin, omax, dsx, dsy, dsz,
+ gageContext *gctx[2][KERN_SIZE_MAX + 1];
+ gagePerVolume *gpvl[2][NRRD_TYPE_MAX + 1][KERN_SIZE_MAX + 1];
+ const double *vansScl[2][NRRD_TYPE_MAX + 1][KERN_SIZE_MAX + 1],
+ *gansScl[2][NRRD_TYPE_MAX + 1][KERN_SIZE_MAX + 1],
+ *hansScl[2][NRRD_TYPE_MAX + 1][KERN_SIZE_MAX + 1];
+ double *origScl, omin, omax, dsx, dsy, dsz,
spcOrig[NRRD_SPACE_DIM_MAX] = {0.0, 0.0, 0.0},
- spcVec[3][NRRD_SPACE_DIM_MAX] = {
- {1.1, 0.0, 0.0},
- {0.0, 2.2, 0.0},
- {0.0, 0.0, 3.3}};
+ spcVec[3][NRRD_SPACE_DIM_MAX] = {{1.1, 0.0, 0.0}, {0.0, 2.2, 0.0}, {0.0, 0.0, 3.3}};
mop = airMopNew();
-#define NRRD_NEW(name, mop) \
- (name) = nrrdNew(); \
+#define NRRD_NEW(name, mop) \
+ (name) = nrrdNew(); \
airMopAdd((mop), (name), (airMopper)nrrdNuke, airMopAlways)
/* --------------------------------------------------------------- */
@@ -82,17 +73,18 @@
if (nrrdMaybeAlloc_nva(norigScl, nrrdTypeDouble, 3, sizes)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "trouble allocating:\n%s", err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
origScl = AIR_CAST(double *, norigScl->data);
nn = nrrdElementNumber(norigScl);
- airSrandMT(42*42);
- for (ii=0; ii<nn/2; ii++) {
- airNormalRand(origScl + 2*ii + 0, origScl + 2*ii + 1);
+ airSrandMT(42 * 42);
+ for (ii = 0; ii < nn / 2; ii++) {
+ airNormalRand(origScl + 2 * ii + 0, origScl + 2 * ii + 1);
}
/* learn real range */
omin = omax = origScl[0];
- for (ii=1; ii<nn; ii++) {
+ for (ii = 1; ii < nn; ii++) {
omin = AIR_MIN(omin, origScl[ii]);
omax = AIR_MAX(omax, origScl[ii]);
}
@@ -101,7 +93,8 @@
|| nrrdSpaceOriginSet(norigScl, spcOrig)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "trouble setting space:\n%s", err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
nrrdAxisInfoSet_nva(norigScl, nrrdAxisInfoSpaceDirection, spcVec);
dsx = AIR_CAST(double, sizes[0]);
@@ -110,9 +103,8 @@
sx = AIR_CAST(unsigned int, sizes[0]);
sy = AIR_CAST(unsigned int, sizes[1]);
sz = AIR_CAST(unsigned int, sizes[2]);
- subnum = AIR_CAST(unsigned int, PROBE_NUM*0.9);
+ subnum = AIR_CAST(unsigned int, PROBE_NUM * 0.9);
-
/* --------------------------------------------------------------- */
/* Quantizing to 8-bits and checking */
submop = airMopNew();
@@ -121,17 +113,19 @@
NRRD_NEW(nqdiff, submop);
if (nrrdQuantize(nucharScl, norigScl, NULL, 8)
|| nrrdUnquantize(nunquant, nucharScl, nrrdTypeDouble)
- || nrrdArithBinaryOp(nqdiff, nrrdBinaryOpSubtract,
- norigScl, nunquant)) {
+ || nrrdArithBinaryOp(nqdiff, nrrdBinaryOpSubtract, norigScl, nunquant)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "trouble quantizing and back:\n%s", err);
- airMopError(submop); airMopError(mop); return 1;
+ airMopError(submop);
+ airMopError(mop);
+ return 1;
}
- if (!( nucharScl->oldMin == omin
- && nucharScl->oldMax == omax )) {
+ if (!(nucharScl->oldMin == omin && nucharScl->oldMax == omax)) {
fprintf(stderr, "quantization range [%g,%g] != real range [%g,%g]\n",
nucharScl->oldMin, nucharScl->oldMax, omin, omax);
- airMopError(submop); airMopError(mop); return 1;
+ airMopError(submop);
+ airMopError(mop);
+ return 1;
}
{
double *qdiff, *unquant;
@@ -138,22 +132,25 @@
/* empirically determined tolerance, which had to be increased in
order to work under valgrind (!)- perhaps because of a
difference in the use of 80-bit registers */
- double epsilon=0.50000000000004;
+ double epsilon = 0.50000000000004;
qdiff = AIR_CAST(double *, nqdiff->data);
unquant = AIR_CAST(double *, nunquant->data);
- for (ii=0; ii<nn; ii++) {
+ for (ii = 0; ii < nn; ii++) {
double dd;
/* with infinite precision, the max difference between original and
quantized values should be exactly half the width (in value)
of 1/256 of value range ==> dd = 0.5 */
- dd = qdiff[ii]*256/(omax - omin);
+ dd = qdiff[ii] * 256 / (omax - omin);
if (AIR_ABS(dd) > epsilon) {
unsigned int ui;
ui = AIR_CAST(unsigned int, ii);
- fprintf(stderr, "|orig[%u]=%.17g - unquant=%.17g|*256/%.17g "
- "= %.17g > %.17g!\n", ui, origScl[ii], unquant[ii],
- omax - omin, AIR_ABS(dd), epsilon);
- airMopError(submop); airMopError(mop); return 1;
+ fprintf(stderr,
+ "|orig[%u]=%.17g - unquant=%.17g|*256/%.17g "
+ "= %.17g > %.17g!\n",
+ ui, origScl[ii], unquant[ii], omax - omin, AIR_ABS(dd), epsilon);
+ airMopError(submop);
+ airMopError(mop);
+ return 1;
}
}
}
@@ -162,7 +159,7 @@
/* --------------------------------------------------------------- */
/* Converting to all other types */
- for (typi=nrrdTypeUnknown+1; typi<nrrdTypeLast; typi++) {
+ for (typi = nrrdTypeUnknown + 1; typi < nrrdTypeLast; typi++) {
if (nrrdTypeBlock == typi) {
nconvScl[typi] = NULL;
continue;
@@ -171,10 +168,11 @@
if (nrrdConvert(nconvScl[typi], nucharScl, typi)) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "trouble converting:\n%s", err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
- for (supi=1; supi<=KERN_SIZE_MAX; supi++) {
+ for (supi = 1; supi <= KERN_SIZE_MAX; supi++) {
unsigned int pvii;
int E;
double kparm[1];
@@ -184,17 +182,17 @@
gageParmSet(gctx[0][supi], gageParmCheckIntegrals, AIR_TRUE);
kparm[0] = supi;
E = 0;
- if (!E) E |= gageKernelSet(gctx[0][supi], gageKernel00,
- nrrdKernelBoxSupportDebug, kparm);
+ if (!E)
+ E |= gageKernelSet(gctx[0][supi], gageKernel00, nrrdKernelBoxSupportDebug, kparm);
pvii = 0;
- for (typi=nrrdTypeUnknown+1; typi<nrrdTypeLast; typi++) {
+ for (typi = nrrdTypeUnknown + 1; typi < nrrdTypeLast; typi++) {
if (nrrdTypeBlock == typi) {
gpvl[0][typi][supi] = NULL;
continue;
}
- if (!E) E |= !(gpvl[0][typi][supi]
- = gagePerVolumeNew(gctx[0][supi], nconvScl[typi],
- gageKindScl));
+ if (!E)
+ E |= !(gpvl[0][typi][supi] = gagePerVolumeNew(gctx[0][supi], nconvScl[typi],
+ gageKindScl));
if (!E) E |= gagePerVolumeAttach(gctx[0][supi], gpvl[0][typi][supi]);
if (1 == supi) {
/* first time through this typi loop; its the occasion to
@@ -203,8 +201,7 @@
Having to do this is a symptom of bad API design in gage */
pvlIdx[typi] = pvii++;
}
- if (!E) E |= gageQueryItemOn(gctx[0][supi], gpvl[0][typi][supi],
- gageSclValue);
+ if (!E) E |= gageQueryItemOn(gctx[0][supi], gpvl[0][typi][supi], gageSclValue);
if (E) {
break;
}
@@ -212,16 +209,18 @@
if (!E) E |= gageUpdate(gctx[0][supi]);
if (E) {
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
- fprintf(stderr, "trouble (supi=%u, %d/%s) set-up:\n%s\n",
- supi, typi, airEnumStr(nrrdType, typi), err);
- airMopError(mop); return 1;
+ fprintf(stderr, "trouble (supi=%u, %d/%s) set-up:\n%s\n", supi, typi,
+ airEnumStr(nrrdType, typi), err);
+ airMopError(mop);
+ return 1;
}
if (gctx[0][supi]->radius != supi) {
- fprintf(stderr, "supi %u != gageContext->radius %u\n",
- supi, gctx[0][supi]->radius);
- airMopError(mop); return 1;
+ fprintf(stderr, "supi %u != gageContext->radius %u\n", supi,
+ gctx[0][supi]->radius);
+ airMopError(mop);
+ return 1;
}
- for (typi=nrrdTypeUnknown+1; typi<nrrdTypeLast; typi++) {
+ for (typi = nrrdTypeUnknown + 1; typi < nrrdTypeLast; typi++) {
if (nrrdTypeBlock == typi) {
vansScl[0][typi][supi] = NULL;
gansScl[0][typi][supi] = NULL;
@@ -228,25 +227,25 @@
hansScl[0][typi][supi] = NULL;
continue;
}
- vansScl[0][typi][supi] =
- gageAnswerPointer(gctx[0][supi], gpvl[0][typi][supi], gageSclValue);
- gansScl[0][typi][supi] =
- gageAnswerPointer(gctx[0][supi], gpvl[0][typi][supi], gageSclGradVec);
- hansScl[0][typi][supi] =
- gageAnswerPointer(gctx[0][supi], gpvl[0][typi][supi], gageSclHessian);
+ vansScl[0][typi][supi] = gageAnswerPointer(gctx[0][supi], gpvl[0][typi][supi],
+ gageSclValue);
+ gansScl[0][typi][supi] = gageAnswerPointer(gctx[0][supi], gpvl[0][typi][supi],
+ gageSclGradVec);
+ hansScl[0][typi][supi] = gageAnswerPointer(gctx[0][supi], gpvl[0][typi][supi],
+ gageSclHessian);
}
}
/* --------------------------------------------------------------- */
/* Exercising gageContextCopy */
- for (supi=1; supi<=KERN_SIZE_MAX; supi++) {
+ for (supi = 1; supi <= KERN_SIZE_MAX; supi++) {
if (!(gctx[1][supi] = gageContextCopy(gctx[0][supi]))) {
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
- fprintf(stderr, "trouble copying gctx[%u]:\n%s\n",
- supi, err);
- airMopError(mop); return 1;
+ fprintf(stderr, "trouble copying gctx[%u]:\n%s\n", supi, err);
+ airMopError(mop);
+ return 1;
}
- for (typi=nrrdTypeUnknown+1; typi<nrrdTypeLast; typi++) {
+ for (typi = nrrdTypeUnknown + 1; typi < nrrdTypeLast; typi++) {
if (nrrdTypeBlock == typi) {
vansScl[1][typi][supi] = NULL;
gansScl[1][typi][supi] = NULL;
@@ -254,12 +253,12 @@
continue;
}
gpvl[1][typi][supi] = gctx[1][supi]->pvl[pvlIdx[typi]];
- vansScl[1][typi][supi] =
- gageAnswerPointer(gctx[1][supi], gpvl[1][typi][supi], gageSclValue);
- gansScl[1][typi][supi] =
- gageAnswerPointer(gctx[1][supi], gpvl[1][typi][supi], gageSclGradVec);
- hansScl[1][typi][supi] =
- gageAnswerPointer(gctx[1][supi], gpvl[1][typi][supi], gageSclHessian);
+ vansScl[1][typi][supi] = gageAnswerPointer(gctx[1][supi], gpvl[1][typi][supi],
+ gageSclValue);
+ gansScl[1][typi][supi] = gageAnswerPointer(gctx[1][supi], gpvl[1][typi][supi],
+ gageSclGradVec);
+ hansScl[1][typi][supi] = gageAnswerPointer(gctx[1][supi], gpvl[1][typi][supi],
+ gageSclHessian);
}
}
@@ -270,16 +269,15 @@
Because nrrdKernelBoxSupportDebug has already been set prior to
the first pass, there is some some second-time only "if (1 ==
probePass)" logic that confuses the clarity of this */
- for (probePass=0; probePass<=1; probePass++) {
- unsigned int prbi, lastjj=0, xi, yi, zi;
- double thet, xu, yu, zu, dxi, dyi, dzi,
- elapsed[2][KERN_SIZE_MAX+1], time0;
- char errpre[AIR_STRLEN_LARGE];
+ for (probePass = 0; probePass <= 1; probePass++) {
+ unsigned int prbi, lastjj = 0, xi, yi, zi;
+ double thet, xu, yu, zu, dxi, dyi, dzi, elapsed[2][KERN_SIZE_MAX + 1], time0;
+ char errpre[AIR_STRLEN_LARGE + 1];
if (1 == probePass) {
/* switch to cos^4 kernel, turn on gradient and hessian */
- for (cti=0; cti<2; cti++) {
- for (supi=1; supi<=KERN_SIZE_MAX; supi++) {
+ for (cti = 0; cti < 2; cti++) {
+ for (supi = 1; supi <= KERN_SIZE_MAX; supi++) {
int E;
double kparm[1];
gageParmSet(gctx[cti][supi], gageParmRenormalize, AIR_FALSE);
@@ -286,22 +284,27 @@
gageParmSet(gctx[cti][supi], gageParmCheckIntegrals, AIR_TRUE);
kparm[0] = supi;
E = 0;
- if (!E) E |= gageKernelSet(gctx[cti][supi], gageKernel00,
- nrrdKernelCos4SupportDebug, kparm);
- if (!E) E |= gageKernelSet(gctx[cti][supi], gageKernel11,
- nrrdKernelCos4SupportDebugD, kparm);
- if (!E) E |= gageKernelSet(gctx[cti][supi], gageKernel22,
- nrrdKernelCos4SupportDebugDD, kparm);
- for (typi=nrrdTypeUnknown+1; typi<nrrdTypeLast; typi++) {
+ if (!E)
+ E |= gageKernelSet(gctx[cti][supi], gageKernel00, nrrdKernelCos4SupportDebug,
+ kparm);
+ if (!E)
+ E |= gageKernelSet(gctx[cti][supi], gageKernel11,
+ nrrdKernelCos4SupportDebugD, kparm);
+ if (!E)
+ E |= gageKernelSet(gctx[cti][supi], gageKernel22,
+ nrrdKernelCos4SupportDebugDD, kparm);
+ for (typi = nrrdTypeUnknown + 1; typi < nrrdTypeLast; typi++) {
if (nrrdTypeBlock == typi) {
continue;
}
- if (!E) E |= gageQueryItemOn(gctx[cti][supi],
- gpvl[cti][typi][supi],
- gageSclGradVec);
- if (!E) E |= gageQueryItemOn(gctx[cti][supi],
- gpvl[cti][typi][supi],
- gageSclHessian);
+ if (!E)
+ E |= gageQueryItemOn(gctx[cti][supi],
+ gpvl[cti][typi][supi],
+ gageSclGradVec);
+ if (!E)
+ E |= gageQueryItemOn(gctx[cti][supi],
+ gpvl[cti][typi][supi],
+ gageSclHessian);
if (E) {
break;
}
@@ -309,30 +312,32 @@
if (!E) E |= gageUpdate(gctx[cti][supi]);
if (E) {
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
- fprintf(stderr, "trouble (cti=%u, supi=%u, %d/%s) "
- "set-up:\n%s\n", cti,
- supi, typi, airEnumStr(nrrdType, typi), err);
- airMopError(mop); return 1;
+ fprintf(stderr,
+ "trouble (cti=%u, supi=%u, %d/%s) "
+ "set-up:\n%s\n",
+ cti, supi, typi, airEnumStr(nrrdType, typi), err);
+ airMopError(mop);
+ return 1;
}
}
}
}
- for (cti=0; cti<2; cti++) {
- for (supi=1; supi<=KERN_SIZE_MAX; supi++) {
+ for (cti = 0; cti < 2; cti++) {
+ for (supi = 1; supi <= KERN_SIZE_MAX; supi++) {
elapsed[cti][supi] = 0.0;
}
}
/* do the probes along a curvy path */
- for (prbi=0; prbi<PROBE_NUM; prbi++) {
+ for (prbi = 0; prbi < PROBE_NUM; prbi++) {
unsigned int jj;
- jj = airIndex(0, prbi, PROBE_NUM-1, subnum);
- thet = AIR_AFFINE(0, jj, subnum-1, 0.0, AIR_PI);
- xu = -cos(5*thet);
- yu = -cos(3*thet);
+ jj = airIndex(0, prbi, PROBE_NUM - 1, subnum);
+ thet = AIR_AFFINE(0, jj, subnum - 1, 0.0, AIR_PI);
+ xu = -cos(5 * thet);
+ yu = -cos(3 * thet);
zu = -cos(thet);
- dxi = AIR_AFFINE(-1.0, xu, 1.0, -0.5, dsx-0.5);
- dyi = AIR_AFFINE(-1.0, yu, 1.0, -0.5, dsy-0.5);
- dzi = AIR_AFFINE(-1.0, zu, 1.0, -0.5, dsz-0.5);
+ dxi = AIR_AFFINE(-1.0, xu, 1.0, -0.5, dsx - 0.5);
+ dyi = AIR_AFFINE(-1.0, yu, 1.0, -0.5, dsy - 0.5);
+ dzi = AIR_AFFINE(-1.0, zu, 1.0, -0.5, dsz - 0.5);
if (prbi && lastjj == jj) {
/* this occasionally tests the logic in gage that seeks to
re-compute convolution weights only when necessary */
@@ -340,27 +345,25 @@
dyi += airSgn(yu);
dzi += airSgn(zu);
}
- xi = airIndexClamp(-0.5, dxi, dsx-0.5, sx);
- yi = airIndexClamp(-0.5, dyi, dsy-0.5, sy);
- zi = airIndexClamp(-0.5, dzi, dsz-0.5, sz);
+ xi = airIndexClamp(-0.5, dxi, dsx - 0.5, sx);
+ yi = airIndexClamp(-0.5, dyi, dsy - 0.5, sy);
+ zi = airIndexClamp(-0.5, dzi, dsz - 0.5, sz);
lastjj = jj;
- for (supi=1; supi<=KERN_SIZE_MAX; supi++) {
- double truevalOrig[NRRD_TYPE_MAX+1];
- for (cti=0; cti<2; cti++) {
+ for (supi = 1; supi <= KERN_SIZE_MAX; supi++) {
+ double truevalOrig[NRRD_TYPE_MAX + 1];
+ for (cti = 0; cti < 2; cti++) {
time0 = airTime();
- if (gageProbeSpace(gctx[cti][supi], dxi, dyi, dzi,
- AIR_TRUE /* indexSpace */,
+ if (gageProbeSpace(gctx[cti][supi], dxi, dyi, dzi, AIR_TRUE /* indexSpace */,
AIR_TRUE /* clamp */)) {
- fprintf(stderr, "probe (cti %u support %u) error (%d): %s\n",
- cti, supi,
+ fprintf(stderr, "probe (cti %u support %u) error (%d): %s\n", cti, supi,
gctx[cti][supi]->errNum, gctx[cti][supi]->errStr);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
elapsed[cti][supi] = airTime() - time0;
- for (typi=nrrdTypeUnknown+1; typi<nrrdTypeLast; typi++) {
+ for (typi = nrrdTypeUnknown + 1; typi < nrrdTypeLast; typi++) {
double arrayval, trueval, probeval;
- if (nrrdTypeBlock == typi
- || (1 == probePass && nrrdTypeChar == typi)) {
+ if (nrrdTypeBlock == typi || (1 == probePass && nrrdTypeChar == typi)) {
/* can't easily correct interpolation on signed char
values to make it match interpolation on unsigned char
values, prior to wrap-around */
@@ -372,20 +375,20 @@
/* arrayval is the value directly from array of same type
(converted from original uchar) */
arrayval = (nrrdDLookup[typi])(nconvScl[typi]->data,
- xi + sx*(yi + sy*zi));
+ xi + sx * (yi + sy * zi));
/* when using box, gage-reconstructed value should
match value from probing */
if (arrayval != probeval) {
-#define SPRINT_ERR_PREFIX \
- errPrefix(errpre, typi, supi, prbi, probePass, \
- dxi, dyi, dzi, xi, yi, zi)
+#define SPRINT_ERR_PREFIX \
+ errPrefix(errpre, typi, supi, prbi, probePass, dxi, dyi, dzi, xi, yi, zi)
SPRINT_ERR_PREFIX;
- fprintf(stderr, "%s: (cti %u) probed %g != conv %g\n", errpre,
- cti, probeval, arrayval);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: (cti %u) probed %g != conv %g\n", errpre, cti,
+ probeval, arrayval);
+ airMopError(mop);
+ return 1;
}
/* trueval on pass 0 is the original uchar value */
- trueval = AIR_CAST(double, ucharScl[xi + sx*(yi + sy*zi)]);
+ trueval = AIR_CAST(double, ucharScl[xi + sx * (yi + sy * zi)]);
} else {
/* trueval on pass 1 is the value from probing uchar volume */
trueval = vansScl[cti][nrrdTypeUChar][supi][0];
@@ -401,9 +404,10 @@
(trueval) is same result as original (truevalOrig[typi]) */
if (truevalOrig[typi] != trueval) {
SPRINT_ERR_PREFIX;
- fprintf(stderr, "%s: original->%g, gageContextCopy->%g\n",
- errpre, truevalOrig[typi], trueval);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: original->%g, gageContextCopy->%g\n", errpre,
+ truevalOrig[typi], trueval);
+ airMopError(mop);
+ return 1;
}
}
/* regardless of the volume (excepting where we've continue'd,
@@ -410,9 +414,10 @@
above) the reconstructed value probeval should match trueval */
if (trueval != probeval) {
SPRINT_ERR_PREFIX;
- fprintf(stderr, "%s: (cti %u) probed %g != true %g\n", errpre,
- cti, probeval, trueval);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: (cti %u) probed %g != true %g\n", errpre, cti,
+ probeval, trueval);
+ airMopError(mop);
+ return 1;
}
if (1 == probePass) {
/* and when we use a differentiable kernel, the gradient
@@ -423,9 +428,10 @@
gansScl[cti][typi][supi]);
if (ELL_3V_LEN(diff3) > 0.0) {
SPRINT_ERR_PREFIX;
- fprintf(stderr, "%s: (cti %u) probed gradient error len %f\n",
- errpre, cti, ELL_3V_LEN(diff3));
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: (cti %u) probed gradient error len %f\n", errpre,
+ cti, ELL_3V_LEN(diff3));
+ airMopError(mop);
+ return 1;
}
ELL_9V_SUB(diff9,
hansScl[cti][nrrdTypeUChar][supi],
@@ -432,9 +438,10 @@
hansScl[cti][typi][supi]);
if (ELL_9V_LEN(diff9) > 0.0) {
SPRINT_ERR_PREFIX;
- fprintf(stderr, "%s: (cti %u) probed hessian error len %f\n",
- errpre, cti, ELL_9V_LEN(diff9));
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: (cti %u) probed hessian error len %f\n", errpre,
+ cti, ELL_9V_LEN(diff9));
+ airMopError(mop);
+ return 1;
}
}
}
@@ -441,10 +448,10 @@
}
}
}
- for (cti=0; cti<2; cti++) {
- for (supi=1; supi<=KERN_SIZE_MAX; supi++) {
- fprintf(stderr, "elapsed[%u][%u] = %g ms\n",
- cti, supi, 1000*elapsed[cti][supi]);
+ for (cti = 0; cti < 2; cti++) {
+ for (supi = 1; supi <= KERN_SIZE_MAX; supi++) {
+ fprintf(stderr, "elapsed[%u][%u] = %g ms\n", cti, supi,
+ 1000 * elapsed[cti][supi]);
}
}
}
Modified: teem/trunk/Testing/gage/probeScl.c
===================================================================
--- teem/trunk/Testing/gage/probeScl.c 2024-07-17 17:53:02 UTC (rev 7216)
+++ teem/trunk/Testing/gage/probeScl.c 2024-07-17 17:54:47 UTC (rev 7217)
@@ -30,7 +30,7 @@
*/
#define INTERP_KERN_NUM 4
-#define BLUR_KERN_NUM 5
+#define BLUR_KERN_NUM 5
int
main(int argc, const char **argv) {
@@ -51,11 +51,7 @@
const NrrdKernel *bkernD[BLUR_KERN_NUM];
const NrrdKernel *bkernDD[BLUR_KERN_NUM];
double bkparm[BLUR_KERN_NUM][NRRD_KERNEL_PARMS_NUM] = {
- {1.0},
- {AIR_NAN},
- {AIR_NAN},
- {2.0, 1.0, 0.0},
- {1.2, 5.0},
+ {1.0}, {AIR_NAN}, {AIR_NAN}, {2.0, 1.0, 0.0}, {1.2, 5.0},
};
const double *ivalAns[INTERP_KERN_NUM], *bvalAns[BLUR_KERN_NUM],
*bgrdAns[BLUR_KERN_NUM], *bhesAns[BLUR_KERN_NUM];
@@ -94,16 +90,16 @@
if (nrrdLoad(nscl, fullname, NULL)) {
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
- fprintf(stderr, "%s: trouble reading data \"%s\":\n%s",
- me, fullname, err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: trouble reading data \"%s\":\n%s", me, fullname, err);
+ airMopError(mop);
+ return 1;
}
/* make sure its a double-type volume (assumed below) */
if (nrrdTypeDouble != nscl->type) {
fprintf(stderr, "%s: volume type %s != expected type %s\n", me,
- airEnumStr(nrrdType, nscl->type),
- airEnumStr(nrrdType, nrrdTypeDouble));
- airMopError(mop); return 1;
+ airEnumStr(nrrdType, nscl->type), airEnumStr(nrrdType, nrrdTypeDouble));
+ airMopError(mop);
+ return 1;
}
dscl = AIR_CAST(double *, nscl->data);
sx = AIR_CAST(unsigned int, nscl->axis[0].size);
@@ -110,7 +106,7 @@
sy = AIR_CAST(unsigned int, nscl->axis[1].size);
sz = AIR_CAST(unsigned int, nscl->axis[2].size);
- for (ki=0; ki<INTERP_KERN_NUM; ki++) {
+ for (ki = 0; ki < INTERP_KERN_NUM; ki++) {
gagePerVolume *gpvl;
igctx[ki] = gageContextNew();
airMopAdd(mop, igctx[ki], (airMopper)gageContextNix, airMopAlways);
@@ -119,8 +115,7 @@
gageParmSet(igctx[ki], gageParmOrientationFromSpacing, AIR_FALSE);
E = 0;
if (!E) E |= !(gpvl = gagePerVolumeNew(igctx[ki], nscl, gageKindScl));
- if (!E) E |= gageKernelSet(igctx[ki], gageKernel00,
- ikern[ki], ikparm[ki]);
+ if (!E) E |= gageKernelSet(igctx[ki], gageKernel00, ikern[ki], ikparm[ki]);
if (!E) E |= gagePerVolumeAttach(igctx[ki], gpvl);
if (!E) E |= gageQueryItemOn(igctx[ki], gpvl, gageSclValue);
if (!E) E |= gageUpdate(igctx[ki]);
@@ -127,9 +122,9 @@
if (E) {
char *err;
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
- fprintf(stderr, "%s: trouble %s set-up:\n%s\n", me,
- ikern[ki]->name, err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: trouble %s set-up:\n%s\n", me, ikern[ki]->name, err);
+ airMopError(mop);
+ return 1;
}
ivalAns[ki] = gageAnswerPointer(igctx[ki], gpvl, gageSclValue);
}
@@ -140,27 +135,29 @@
unsigned int xi, yi, zi;
double pval[INTERP_KERN_NUM], err, rval;
int pret;
- for (zi=0; zi<sz; zi++) {
- for (yi=0; yi<sy; yi++) {
- for (xi=0; xi<sx; xi++) {
- rval = dscl[xi + sx*(yi + sy*zi)];
- for (ki=0; ki<INTERP_KERN_NUM; ki++) {
- pret = gageProbeSpace(igctx[ki], xi, yi, zi,
- AIR_TRUE /* indexSpace */,
+ for (zi = 0; zi < sz; zi++) {
+ for (yi = 0; yi < sy; yi++) {
+ for (xi = 0; xi < sx; xi++) {
+ rval = dscl[xi + sx * (yi + sy * zi)];
+ for (ki = 0; ki < INTERP_KERN_NUM; ki++) {
+ pret = gageProbeSpace(igctx[ki], xi, yi, zi, AIR_TRUE /* indexSpace */,
AIR_FALSE /* clamp */);
if (pret) {
- fprintf(stderr, "%s: %s probe error(%d): %s\n", me,
- ikern[ki]->name, igctx[ki]->errNum, igctx[ki]->errStr);
+ fprintf(stderr, "%s: %s probe error(%d): %s\n", me, ikern[ki]->name,
+ igctx[ki]->errNum, igctx[ki]->errStr);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
pval[ki] = *ivalAns[ki];
err = AIR_ABS(rval - pval[ki]);
if (err) {
- fprintf(stderr, "%s: interp's [%u,%u,%u] %s probe %f "
- "!= true %f (err %f)\n", me, xi, yi, zi,
- ikern[ki]->name, pval[ki], rval, err);
- airMopError(mop); return 1;
+ fprintf(stderr,
+ "%s: interp's [%u,%u,%u] %s probe %f "
+ "!= true %f (err %f)\n",
+ me, xi, yi, zi, ikern[ki]->name, pval[ki], rval, err);
+ airMopError(mop);
+ return 1;
}
}
}
@@ -170,7 +167,7 @@
/* set up contexts for non-interpolating (blurring) kernels,
and their first and second derivatives */
- for (ki=0; ki<BLUR_KERN_NUM; ki++) {
+ for (ki = 0; ki < BLUR_KERN_NUM; ki++) {
gagePerVolume *gpvl;
bgctx[ki] = gageContextNew();
airMopAdd(mop, bgctx[ki], (airMopper)gageContextNix, airMopAlways);
@@ -179,12 +176,9 @@
gageParmSet(bgctx[ki], gageParmOrientationFromSpacing, AIR_FALSE);
E = 0;
if (!E) E |= !(gpvl = gagePerVolumeNew(bgctx[ki], nscl, gageKindScl));
- if (!E) E |= gageKernelSet(bgctx[ki], gageKernel00,
- bkern[ki], bkparm[ki]);
- if (!E) E |= gageKernelSet(bgctx[ki], gageKernel11,
- bkernD[ki], bkparm[ki]);
- if (!E) E |= gageKernelSet(bgctx[ki], gageKernel22,
- bkernDD[ki], bkparm[ki]);
+ if (!E) E |= gageKernelSet(bgctx[ki], gageKernel00, bkern[ki], bkparm[ki]);
+ if (!E) E |= gageKernelSet(bgctx[ki], gageKernel11, bkernD[ki], bkparm[ki]);
+ if (!E) E |= gageKernelSet(bgctx[ki], gageKernel22, bkernDD[ki], bkparm[ki]);
if (!E) E |= gagePerVolumeAttach(bgctx[ki], gpvl);
if (!E) E |= gageQueryItemOn(bgctx[ki], gpvl, gageSclValue);
if (!E) E |= gageQueryItemOn(bgctx[ki], gpvl, gageSclGradVec);
@@ -193,9 +187,9 @@
if (E) {
char *err;
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
- fprintf(stderr, "%s: trouble %s set-up:\n%s\n", me,
- bkern[ki]->name, err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: trouble %s set-up:\n%s\n", me, bkern[ki]->name, err);
+ airMopError(mop);
+ return 1;
}
fprintf(stderr, "%s radius = %u\n", bkern[ki]->name, bgctx[ki]->radius);
bvalAns[ki] = gageAnswerPointer(bgctx[ki], gpvl, gageSclValue);
@@ -205,12 +199,11 @@
{
#define POS_NUM 12
- double xp[POS_NUM], yp[POS_NUM], zp[POS_NUM],
- pos[POS_NUM*POS_NUM*POS_NUM][3], *prbd,
- offs[POS_NUM/2] = {0, 1.22222, 2.444444, 3.777777, 5.88888, 7.55555};
+ double xp[POS_NUM], yp[POS_NUM], zp[POS_NUM], pos[POS_NUM * POS_NUM * POS_NUM][3],
+ *prbd, offs[POS_NUM / 2] = {0, 1.22222, 2.444444, 3.777777, 5.88888, 7.55555};
Nrrd *nprbd, *ncorr;
unsigned int ii, jj, kk, qlen = 1 + 3 + 9;
- char *corrfn, explain[AIR_STRLEN_LARGE];
+ char *corrfn, explain[AIR_STRLEN_LARGE + 1];
int pret, differ;
corrfn = testDataPathPrefix("test/probeSclAns.nrrd");
@@ -220,64 +213,65 @@
if (nrrdLoad(ncorr, corrfn, NULL)) {
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
- fprintf(stderr, "%s: trouble reading data \"%s\":\n%s",
- me, corrfn, err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: trouble reading data \"%s\":\n%s", me, corrfn, err);
+ airMopError(mop);
+ return 1;
}
- for (ii=0; ii<POS_NUM/2; ii++) {
+ for (ii = 0; ii < POS_NUM / 2; ii++) {
xp[ii] = yp[ii] = zp[ii] = offs[ii];
- xp[POS_NUM-1-ii] = AIR_CAST(double, sx)-1.0-offs[ii];
- yp[POS_NUM-1-ii] = AIR_CAST(double, sy)-1.0-offs[ii];
- zp[POS_NUM-1-ii] = AIR_CAST(double, sz)-1.0-offs[ii];
+ xp[POS_NUM - 1 - ii] = AIR_CAST(double, sx) - 1.0 - offs[ii];
+ yp[POS_NUM - 1 - ii] = AIR_CAST(double, sy) - 1.0 - offs[ii];
+ zp[POS_NUM - 1 - ii] = AIR_CAST(double, sz) - 1.0 - offs[ii];
}
- for (kk=0; kk<POS_NUM; kk++) {
- for (jj=0; jj<POS_NUM; jj++) {
- for (ii=0; ii<POS_NUM; ii++) {
- ELL_3V_SET(pos[ii + POS_NUM*(jj + POS_NUM*kk)],
- xp[ii], yp[jj], zp[kk]);
+ for (kk = 0; kk < POS_NUM; kk++) {
+ for (jj = 0; jj < POS_NUM; jj++) {
+ for (ii = 0; ii < POS_NUM; ii++) {
+ ELL_3V_SET(pos[ii + POS_NUM * (jj + POS_NUM * kk)], xp[ii], yp[jj], zp[kk]);
}
}
}
nprbd = nrrdNew();
airMopAdd(mop, nprbd, (airMopper)nrrdNuke, airMopAlways);
- if (nrrdMaybeAlloc_va(nprbd, nrrdTypeDouble, 3,
- AIR_CAST(size_t, qlen),
+ if (nrrdMaybeAlloc_va(nprbd, nrrdTypeDouble, 3, AIR_CAST(size_t, qlen),
AIR_CAST(size_t, BLUR_KERN_NUM),
- AIR_CAST(size_t, POS_NUM*POS_NUM*POS_NUM))) {
+ AIR_CAST(size_t, POS_NUM * POS_NUM * POS_NUM))) {
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble setting up prbd:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
prbd = AIR_CAST(double *, nprbd->data);
- for (ii=0; ii<POS_NUM*POS_NUM*POS_NUM; ii++) {
- for (ki=0; ki<BLUR_KERN_NUM; ki++) {
+ for (ii = 0; ii < POS_NUM * POS_NUM * POS_NUM; ii++) {
+ for (ki = 0; ki < BLUR_KERN_NUM; ki++) {
pret = gageProbeSpace(bgctx[ki], pos[ii][0], pos[ii][1], pos[ii][2],
- AIR_TRUE /* indexSpace */,
- AIR_FALSE /* clamp */);
+ AIR_TRUE /* indexSpace */, AIR_FALSE /* clamp */);
if (pret) {
- fprintf(stderr, "%s: %s probe error(%d): %s\n", me,
- bkern[ki]->name, bgctx[ki]->errNum, bgctx[ki]->errStr);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: %s probe error(%d): %s\n", me, bkern[ki]->name,
+ bgctx[ki]->errNum, bgctx[ki]->errStr);
+ airMopError(mop);
+ return 1;
}
- prbd[0 + qlen*(ki + BLUR_KERN_NUM*(ii))] = bvalAns[ki][0];
- ELL_3V_COPY(prbd + 1 + qlen*(ki + BLUR_KERN_NUM*(ii)), bgrdAns[ki]);
- ELL_9V_COPY(prbd + 4 + qlen*(ki + BLUR_KERN_NUM*(ii)), bhesAns[ki]);
+ prbd[0 + qlen * (ki + BLUR_KERN_NUM * (ii))] = bvalAns[ki][0];
+ ELL_3V_COPY(prbd + 1 + qlen * (ki + BLUR_KERN_NUM * (ii)), bgrdAns[ki]);
+ ELL_9V_COPY(prbd + 4 + qlen * (ki + BLUR_KERN_NUM * (ii)), bhesAns[ki]);
}
}
/* HEY: weirdly, so far its only on Windows (and more than 10 times worse
on Cygwin) this epsilon needs to be larger than zero, and only for the
radius 6 Gaussian? */
- if (nrrdCompare(ncorr, nprbd, AIR_FALSE /* onlyData */,
- 8.0e-14 /* epsilon */, &differ, explain)) {
+ if (nrrdCompare(ncorr, nprbd, AIR_FALSE /* onlyData */, 8.0e-14 /* epsilon */,
+ &differ, explain)) {
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble comparing:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (differ) {
fprintf(stderr, "%s: probed values not correct: %s\n", me, explain);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
} else {
fprintf(stderr, "all good\n");
}
Modified: teem/trunk/Testing/gage/tsbp.c
===================================================================
--- teem/trunk/Testing/gage/tsbp.c 2024-07-17 17:53:02 UTC (rev 7216)
+++ teem/trunk/Testing/gage/tsbp.c 2024-07-17 17:54:47 UTC (rev 7217)
@@ -37,16 +37,17 @@
gageStackBlurParm *sbp, *sbq;
airArray *mop;
char *err;
-char buff[AIR_STRLEN_LARGE];
+char buff[AIR_STRLEN_LARGE + 1];
void
parseFailOrDie(const char *str) {
- static const char me[]="parseFailOrDie";
+ static const char me[] = "parseFailOrDie";
fprintf(stderr, "%s(\"%s\"): ", me, str);
if (!gageStackBlurParmParse(sbp, extraFlag, &extraParm, str)) {
fprintf(stderr, "problem did NOT fail!\n");
- airMopError(mop); exit(1);
+ airMopError(mop);
+ exit(1);
}
/* else good, we got an error */
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
@@ -56,21 +57,22 @@
void
parseOrDie(const char *str) {
- static const char me[]="parseOrDie";
+ static const char me[] = "parseOrDie";
int differ;
- char explain[AIR_STRLEN_LARGE]="!explain_not_set!";
+ char explain[AIR_STRLEN_LARGE + 1] = "!explain_not_set!";
if (gageStackBlurParmParse(sbp, extraFlag, &extraParm, str)
|| gageStackBlurParmSprint(buff, sbp, extraFlag, extraParm)) {
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
- fprintf(stderr, "%s: failed to parse \"%s\" or then sprint: %s\n",
- me, str, err);
- airMopError(mop); exit(1);
+ fprintf(stderr, "%s: failed to parse \"%s\" or then sprint: %s\n", me, str, err);
+ airMopError(mop);
+ exit(1);
}
if (gageStackBlurParmParse(sbq, extraFlag, &extraParm, str)) {
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
fprintf(stderr, "%s: failed to parse \"%s\": %s\n", me, str, err);
- airMopError(mop); exit(1);
+ airMopError(mop);
+ exit(1);
}
/* can tweak sbq here to make sure compare is working */
/*
@@ -85,16 +87,16 @@
nrrdBoundarySpecParse(sbp->bspec, "pad:3");
nrrdBoundarySpecParse(sbq->bspec, "pad:2");
*/
- if (gageStackBlurParmCompare(sbp, "first", sbq, "second",
- &differ, explain)) {
+ if (gageStackBlurParmCompare(sbp, "first", sbq, "second", &differ, explain)) {
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
fprintf(stderr, "%s: failed to compare: %s", me, err);
- airMopError(mop); exit(1);
+ airMopError(mop);
+ exit(1);
}
if (differ) {
- fprintf(stderr, "%s: two sbps from same string differ: %s\n",
- me, explain);
- airMopError(mop); exit(1);
+ fprintf(stderr, "%s: two sbps from same string differ: %s\n", me, explain);
+ airMopError(mop);
+ exit(1);
}
printf("%s: \"%s\" -> \"%s\"\n", me, str, buff);
gageStackBlurParmInit(sbp);
@@ -102,13 +104,12 @@
return;
}
-static const char *sbpInfo =
- "for testing handling of stack blur parms";
+static const char *sbpInfo = "for testing handling of stack blur parms";
int
main(int argc, const char **argv) {
/* stock variables */
const char *me;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
hestParm *hparm;
/* variables specific to this program */
gageStackBlurParm **sbpv;
@@ -118,19 +119,20 @@
mop = airMopNew();
hparm = hestParmNew();
airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways);
- hestOptAdd(&hopt, "sbp", "sbp0", airTypeOther, 1, -1, &sbpv, NULL,
- "stack blur parms", &sbpNum, NULL, gageHestStackBlurParm);
- hestParseOrDie(hopt, argc-1, argv+1, hparm, me, sbpInfo,
- AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestOptAdd(&hopt, "sbp", "sbp0", airTypeOther, 1, -1, &sbpv, NULL, "stack blur parms",
+ &sbpNum, NULL, gageHestStackBlurParm);
+ hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, sbpInfo, AIR_TRUE, AIR_TRUE,
+ AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
printf("%s: command line options: ---------- \n", me);
- for (sbpIdx=0; sbpIdx<sbpNum; sbpIdx++) {
+ for (sbpIdx = 0; sbpIdx < sbpNum; sbpIdx++) {
if (gageStackBlurParmSprint(buff, sbpv[sbpIdx], NULL, NULL)) {
airMopAdd(mop, err = biffGetDone(GAGE), airFree, airMopAlways);
fprintf(stderr, "%s: problem with sbpv[%u]:%s", me, sbpIdx, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
printf("%s: sbp[%u] = \"%s\"\n", me, sbpIdx, buff);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-17 17:53:10
|
Revision: 7216
http://sourceforge.net/p/teem/code/7216
Author: kindlmann
Date: 2024-07-17 17:53:02 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
fixing uses of AIR_STRLEN_x plus clang-format
Modified Paths:
--------------
teem/trunk/Testing/nrrd/trand.c
Modified: teem/trunk/Testing/nrrd/trand.c
===================================================================
--- teem/trunk/Testing/nrrd/trand.c 2024-07-17 17:50:48 UTC (rev 7215)
+++ teem/trunk/Testing/nrrd/trand.c 2024-07-17 17:53:02 UTC (rev 7216)
@@ -46,20 +46,15 @@
Nrrd *nval, *nhist, *nimg, *nread, *ncorr, *ninmem[3];
double aa, bb, *val;
airArray *mop;
- char *name, explain[AIR_STRLEN_LARGE];
+ char *name, explain[AIR_STRLEN_LARGE + 1];
#define VALS 0
#define HIST 1
#define IMAG 2
/* PGM image since this Teem build might not support PNG */
- static const char * const mine[3] = { "vals.nrrd",
- "histo.nrrd",
- "histo.pgm" };
- static const char * const corr[3] = { "test/trandvals.nrrd",
- "test/trandhisto.nrrd",
- "test/trandhisto.pgm"};
- static const char * const what[3] = { "value",
- "histogram",
- "histogram image" };
+ static const char *const mine[3] = {"vals.nrrd", "histo.nrrd", "histo.pgm"};
+ static const char *const corr[3] = {"test/trandvals.nrrd", "test/trandhisto.nrrd",
+ "test/trandhisto.pgm"};
+ static const char *const what[3] = {"value", "histogram", "histogram image"};
int differ, wi;
AIR_UNUSED(argc);
@@ -66,14 +61,14 @@
me = argv[0];
mop = airMopNew();
- qvalLen = 10*BINS;
- nrrdAlloc_va(nval=nrrdNew(), nrrdTypeDouble, 1, 4*qvalLen);
+ qvalLen = 10 * BINS;
+ nrrdAlloc_va(nval = nrrdNew(), nrrdTypeDouble, 1, 4 * qvalLen);
airMopAdd(mop, nval, (airMopper)nrrdNuke, airMopAlways);
- val = AIR_CAST(double*, nval->data);
+ val = AIR_CAST(double *, nval->data);
- nhist=nrrdNew();
+ nhist = nrrdNew();
airMopAdd(mop, nhist, (airMopper)nrrdNuke, airMopAlways);
- nimg=nrrdNew();
+ nimg = nrrdNew();
airMopAdd(mop, nimg, (airMopper)nrrdNuke, airMopAlways);
nread = nrrdNew();
airMopAdd(mop, nread, (airMopper)nrrdNuke, airMopAlways);
@@ -88,15 +83,15 @@
correct (test/trandvals.nrrd) and generated values differ:
valA[0]=0.36654774192269141 < valB[0]=0.36654774192269146 by 5.55112e-17
Would be nice to figure out exactly what the origin of that is ... */
- for (ii=0; ii<qvalLen; ii++) {
+ for (ii = 0; ii < qvalLen; ii++) {
airNormalRand(&aa, NULL);
val[vi++] = AIR_CAST(float, aa);
}
- for (ii=0; ii<qvalLen; ii++) {
+ for (ii = 0; ii < qvalLen; ii++) {
airNormalRand(NULL, &bb);
val[vi++] = AIR_CAST(float, bb);
}
- for (ii=0; ii<qvalLen; ii++) {
+ for (ii = 0; ii < qvalLen; ii++) {
airNormalRand(&aa, &bb);
val[vi++] = AIR_CAST(float, aa);
val[vi++] = AIR_CAST(float, bb);
@@ -110,49 +105,54 @@
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble:\n%s", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
ninmem[VALS] = nval;
ninmem[HIST] = nhist;
ninmem[IMAG] = nimg;
- for (wi=0; wi<3; wi++) {
+ for (wi = 0; wi < 3; wi++) {
name = testDataPathPrefix(corr[wi]);
airMopAdd(mop, name, airFree, airMopAlways);
- if (nrrdLoad(ncorr, name, NULL)
- || nrrdLoad(nread, mine[wi], NULL)) {
+ if (nrrdLoad(ncorr, name, NULL) || nrrdLoad(nread, mine[wi], NULL)) {
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble reading %s:\n%s", me, err, what[wi]);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
- if (nrrdCompare(ninmem[wi], nread, AIR_FALSE /* onlyData */,
- 0.0 /* epsilon */, &differ, explain)) {
+ if (nrrdCompare(ninmem[wi], nread, AIR_FALSE /* onlyData */, 0.0 /* epsilon */,
+ &differ, explain)) {
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
- fprintf(stderr, "%s: trouble comparing in-mem and from-disk %s:\n%s",
- me, what[wi], err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: trouble comparing in-mem and from-disk %s:\n%s", me, what[wi],
+ err);
+ airMopError(mop);
+ return 1;
}
if (differ) {
- fprintf(stderr, "%s: in-mem and from-disk (%s) %ss differ: %s\n",
- me, mine[wi], what[wi], explain);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: in-mem and from-disk (%s) %ss differ: %s\n", me, mine[wi],
+ what[wi], explain);
+ airMopError(mop);
+ return 1;
} else {
printf("%s: good: in-mem and from-disk %ss same\n", me, what[wi]);
}
- if (nrrdCompare(ncorr, nread, AIR_FALSE /* onlyData */,
- 0.0 /* epsilon */, &differ, explain)) {
+ if (nrrdCompare(ncorr, nread, AIR_FALSE /* onlyData */, 0.0 /* epsilon */, &differ,
+ explain)) {
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
- fprintf(stderr, "%s: trouble comparing correct and generated %s:\n%s",
- me, what[wi], err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: trouble comparing correct and generated %s:\n%s", me,
+ what[wi], err);
+ airMopError(mop);
+ return 1;
}
if (differ) {
- fprintf(stderr, "%s: correct (%s) and generated %ss differ: %s\n",
- me, corr[wi], what[wi], explain);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: correct (%s) and generated %ss differ: %s\n", me, corr[wi],
+ what[wi], explain);
+ airMopError(mop);
+ return 1;
} else {
printf("%s: good: correct and generated %ss same\n", me, what[wi]);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-17 17:50:52
|
Revision: 7215
http://sourceforge.net/p/teem/code/7215
Author: kindlmann
Date: 2024-07-17 17:50:48 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
fixing uses of AIR_STRLEN_x plus clang-format
Modified Paths:
--------------
teem/trunk/Testing/nrrd/macros.c
teem/trunk/Testing/nrrd/tbspec.c
teem/trunk/Testing/nrrd/tload.c
teem/trunk/Testing/nrrd/tskip.c
Modified: teem/trunk/Testing/nrrd/macros.c
===================================================================
--- teem/trunk/Testing/nrrd/macros.c 2024-07-17 17:48:07 UTC (rev 7214)
+++ teem/trunk/Testing/nrrd/macros.c 2024-07-17 17:50:48 UTC (rev 7215)
@@ -33,15 +33,12 @@
int
main() {
- size_t II, *coord0, *ctmp0, *size0,
- coord1[1], ctmp1[1], size1[1],
- coord2[2], ctmp2[2], size2[2],
- coord3[3], ctmp3[3], size3[3],
- coord4[4], ctmp4[4], size4[4];
- char sbuff[NRRD_DIM_MAX*AIR_STRLEN_SMALL],
- scomp[NRRD_DIM_MAX*AIR_STRLEN_SMALL],
- sigab[NRRD_DIM_MAX*AIR_STRLEN_SMALL], /* index gen and back */
- swhat[NRRD_DIM_MAX*AIR_STRLEN_SMALL];
+ size_t II, *coord0, *ctmp0, *size0, coord1[1], ctmp1[1], size1[1], coord2[2], ctmp2[2],
+ size2[2], coord3[3], ctmp3[3], size3[3], coord4[4], ctmp4[4], size4[4];
+ char sbuff[NRRD_DIM_MAX * AIR_STRLEN_SMALL + 1],
+ scomp[NRRD_DIM_MAX * AIR_STRLEN_SMALL + 1],
+ sigab[NRRD_DIM_MAX * AIR_STRLEN_SMALL + 1], /* index gen and back */
+ swhat[NRRD_DIM_MAX * AIR_STRLEN_SMALL + 1];
unsigned int ii, jj, kk, ll;
/* This macro makes sure the given length-N coord##N vector is what it
@@ -49,24 +46,22 @@
airSprintVecSize_t. Also uses NRRD_INDEX_GEN and NRRD_COORD_GEN
to go from coord##N to a linear index II and back to ctmp##N,
and makes sure that that too matches "want" */
-#define CHECK(N, want) \
- airSprintVecSize_t(swhat, size##N, N); \
- airSprintVecSize_t(sbuff, coord##N, N); \
- if (strcmp(sbuff, want)) { \
- fprintf(stderr, "for %s: got %s but wanted %s\n", \
- swhat, sbuff, want); \
- return 1; \
- } \
- NRRD_INDEX_GEN(II, coord##N, size##N, N); \
- NRRD_COORD_GEN(ctmp##N, size##N, N, II); \
- airSprintVecSize_t(sigab, ctmp##N, N); \
- if (strcmp(sbuff, want)) { \
- fprintf(stderr, "for %s: NRRD_{INDEX,COORD}_GEN gave %s but want %s\n", \
- swhat, sbuff, want); \
- return 1; \
+#define CHECK(N, want) \
+ airSprintVecSize_t(swhat, size##N, N); \
+ airSprintVecSize_t(sbuff, coord##N, N); \
+ if (strcmp(sbuff, want)) { \
+ fprintf(stderr, "for %s: got %s but wanted %s\n", swhat, sbuff, want); \
+ return 1; \
+ } \
+ NRRD_INDEX_GEN(II, coord##N, size##N, N); \
+ NRRD_COORD_GEN(ctmp##N, size##N, N, II); \
+ airSprintVecSize_t(sigab, ctmp##N, N); \
+ if (strcmp(sbuff, want)) { \
+ fprintf(stderr, "for %s: NRRD_{INDEX,COORD}_GEN gave %s but want %s\n", swhat, \
+ sbuff, want); \
+ return 1; \
}
-
/* actually airTime will always be positive; this is just to thwart the
compiler thinking coord0 and size0 are necessarily NULL */
if (airTime() > -100) {
@@ -90,17 +85,17 @@
/* 11111111111111111111111111111111111111111111111 */
-#define RUN1 \
- coord1[0] = 0; \
- for (ii=0; ii<size1[0]; ii++) { \
- if (ii) { \
- /* don't increment on the very first time, otherwise do */ \
- NRRD_COORD_INCR(coord1, size1, 1, 0); \
- } \
- airSprintVecSize_t(sbuff, coord1, 1); \
- sprintf(scomp, "[%u]", ii); \
- CHECK(1, scomp); \
- } \
+#define RUN1 \
+ coord1[0] = 0; \
+ for (ii = 0; ii < size1[0]; ii++) { \
+ if (ii) { \
+ /* don't increment on the very first time, otherwise do */ \
+ NRRD_COORD_INCR(coord1, size1, 1, 0); \
+ } \
+ airSprintVecSize_t(sbuff, coord1, 1); \
+ sprintf(scomp, "[%u]", ii); \
+ CHECK(1, scomp); \
+ }
size1[0] = 1;
RUN1;
@@ -110,18 +105,18 @@
/* 22222222222222222222222222222222222222222222222 */
-#define RUN2 \
- coord2[0] = coord2[1] = 0; \
- for (jj=0; jj<size2[1]; jj++) { \
- for (ii=0; ii<size2[0]; ii++) { \
- if (ii || jj) { \
- /* don't increment on the very first time, otherwise do */ \
- NRRD_COORD_INCR(coord2, size2, 2, 0); \
- } \
- airSprintVecSize_t(sbuff, coord2, 2); \
- sprintf(scomp, "[%u,%u]", ii, jj); \
- CHECK(2, scomp); \
- } \
+#define RUN2 \
+ coord2[0] = coord2[1] = 0; \
+ for (jj = 0; jj < size2[1]; jj++) { \
+ for (ii = 0; ii < size2[0]; ii++) { \
+ if (ii || jj) { \
+ /* don't increment on the very first time, otherwise do */ \
+ NRRD_COORD_INCR(coord2, size2, 2, 0); \
+ } \
+ airSprintVecSize_t(sbuff, coord2, 2); \
+ sprintf(scomp, "[%u,%u]", ii, jj); \
+ CHECK(2, scomp); \
+ } \
}
ELL_2V_SET(size2, 1, 1);
@@ -138,20 +133,20 @@
/* 33333333333333333333333333333333333333333333333 */
-#define RUN3 \
- coord3[0] = coord3[1] = coord3[2] = 0; \
- for (kk=0; kk<size3[2]; kk++) { \
- for (jj=0; jj<size3[1]; jj++) { \
- for (ii=0; ii<size3[0]; ii++) { \
- if (ii || jj || kk) { \
- /* don't increment on the very first time, otherwise do */ \
- NRRD_COORD_INCR(coord3, size3, 3, 0); \
- } \
- airSprintVecSize_t(sbuff, coord3, 3); \
- sprintf(scomp, "[%u,%u,%u]", ii, jj, kk); \
- CHECK(3, scomp); \
- } \
- } \
+#define RUN3 \
+ coord3[0] = coord3[1] = coord3[2] = 0; \
+ for (kk = 0; kk < size3[2]; kk++) { \
+ for (jj = 0; jj < size3[1]; jj++) { \
+ for (ii = 0; ii < size3[0]; ii++) { \
+ if (ii || jj || kk) { \
+ /* don't increment on the very first time, otherwise do */ \
+ NRRD_COORD_INCR(coord3, size3, 3, 0); \
+ } \
+ airSprintVecSize_t(sbuff, coord3, 3); \
+ sprintf(scomp, "[%u,%u,%u]", ii, jj, kk); \
+ CHECK(3, scomp); \
+ } \
+ } \
}
ELL_3V_SET(size3, 1, 1, 1);
@@ -171,22 +166,22 @@
/* 44444444444444444444444444444444444444444444444 */
-#define RUN4 \
- coord4[0] = coord4[1] = coord4[2] = coord4[3] = 0; \
- for (ll=0; ll<size4[3]; ll++) { \
- for (kk=0; kk<size4[2]; kk++) { \
- for (jj=0; jj<size4[1]; jj++) { \
- for (ii=0; ii<size4[0]; ii++) { \
- if (ii || jj || kk || ll) { \
- /* don't increment on the very first time, otherwise do */ \
- NRRD_COORD_INCR(coord4, size4, 4, 0); \
- } \
- airSprintVecSize_t(sbuff, coord4, 4); \
- sprintf(scomp, "[%u,%u,%u,%u]", ii, jj, kk, ll); \
- CHECK(4, scomp); \
- } \
- } \
- } \
+#define RUN4 \
+ coord4[0] = coord4[1] = coord4[2] = coord4[3] = 0; \
+ for (ll = 0; ll < size4[3]; ll++) { \
+ for (kk = 0; kk < size4[2]; kk++) { \
+ for (jj = 0; jj < size4[1]; jj++) { \
+ for (ii = 0; ii < size4[0]; ii++) { \
+ if (ii || jj || kk || ll) { \
+ /* don't increment on the very first time, otherwise do */ \
+ NRRD_COORD_INCR(coord4, size4, 4, 0); \
+ } \
+ airSprintVecSize_t(sbuff, coord4, 4); \
+ sprintf(scomp, "[%u,%u,%u,%u]", ii, jj, kk, ll); \
+ CHECK(4, scomp); \
+ } \
+ } \
+ } \
}
ELL_4V_SET(size4, 1, 1, 1, 1);
Modified: teem/trunk/Testing/nrrd/tbspec.c
===================================================================
--- teem/trunk/Testing/nrrd/tbspec.c 2024-07-17 17:48:07 UTC (rev 7214)
+++ teem/trunk/Testing/nrrd/tbspec.c 2024-07-17 17:50:48 UTC (rev 7215)
@@ -35,7 +35,7 @@
void
checkFailOrDie(const NrrdBoundarySpec *bspec, airArray *mop) {
- static const char me[]="checkFailOrDie";
+ static const char me[] = "checkFailOrDie";
char *err;
if (!nrrdBoundarySpecCheck(bspec)) {
@@ -53,7 +53,7 @@
void
parseFailOrDie(NrrdBoundarySpec *bspec, const char *str, airArray *mop) {
- static const char me[]="parseFailOrDie";
+ static const char me[] = "parseFailOrDie";
char *err;
if (!nrrdBoundarySpecParse(bspec, str)) {
@@ -74,14 +74,12 @@
** not on the strings, but that isn't implemented yet
*/
void
-psLoopOrDie(NrrdBoundarySpec *bsp, const char *str,
- airArray *mop) {
- static const char me[]="psLoopOrDie";
+psLoopOrDie(NrrdBoundarySpec *bsp, const char *str, airArray *mop) {
+ static const char me[] = "psLoopOrDie";
char *err;
- char buff[AIR_STRLEN_LARGE];
+ char buff[AIR_STRLEN_LARGE + 1];
- if (nrrdBoundarySpecParse(bsp, str)
- || nrrdBoundarySpecSprint(buff, bsp)) {
+ if (nrrdBoundarySpecParse(bsp, str) || nrrdBoundarySpecSprint(buff, bsp)) {
err = biffGetDone(NRRD);
airMopAdd(mop, err, airFree, airMopAlways);
fprintf(stderr, "%s: error: %s", me, err);
@@ -89,8 +87,7 @@
exit(1);
}
if (strcmp(str, buff)) {
- fprintf(stderr, "%s: parse->sprint->\"%s\" != given \"%s\"\n", me,
- buff, str);
+ fprintf(stderr, "%s: parse->sprint->\"%s\" != given \"%s\"\n", me, buff, str);
airMopError(mop);
exit(1);
}
@@ -98,14 +95,13 @@
return;
}
-static const char *tbspecInfo =
- "for testing handling of boundary specifications";
+static const char *tbspecInfo = "for testing handling of boundary specifications";
int
main(int argc, const char *argv[]) {
/* stock variables */
const char *me;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
hestParm *hparm;
airArray *mop;
/* variables specific to this program */
@@ -112,25 +108,26 @@
char *err;
NrrdBoundarySpec *bspec, **bsv;
unsigned int bsNum, bsIdx;
- char buff[AIR_STRLEN_LARGE];
+ char buff[AIR_STRLEN_LARGE + 1];
me = argv[0];
mop = airMopNew();
hparm = hestParmNew();
airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways);
- hestOptAdd(&hopt, "bs", "bspec0", airTypeOther, 1, -1, &bsv, NULL,
- "bspecs", &bsNum, NULL, nrrdHestBoundarySpec);
- hestParseOrDie(hopt, argc-1, argv+1, hparm, me, tbspecInfo,
- AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestOptAdd(&hopt, "bs", "bspec0", airTypeOther, 1, -1, &bsv, NULL, "bspecs", &bsNum,
+ NULL, nrrdHestBoundarySpec);
+ hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, tbspecInfo, AIR_TRUE, AIR_TRUE,
+ AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
printf("command line options:\n");
- for (bsIdx=0; bsIdx<bsNum; bsIdx++) {
+ for (bsIdx = 0; bsIdx < bsNum; bsIdx++) {
if (nrrdBoundarySpecSprint(buff, bsv[bsIdx])) {
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: problem with bsv[%u]:%s", me, bsIdx, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
printf("%s: bspec[%u] = %s\n", me, bsIdx, buff);
}
Modified: teem/trunk/Testing/nrrd/tload.c
===================================================================
--- teem/trunk/Testing/nrrd/tload.c 2024-07-17 17:48:07 UTC (rev 7214)
+++ teem/trunk/Testing/nrrd/tload.c 2024-07-17 17:50:48 UTC (rev 7215)
@@ -48,21 +48,21 @@
if (nrrdLoad(nin, fullname, NULL)) {
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
- fprintf(stderr, "%s: trouble reading data \"%s\":\n%s",
- me, fullname, err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: trouble reading data \"%s\":\n%s", me, fullname, err);
+ airMopError(mop);
+ return 1;
}
{
Nrrd *ncopy;
- char *blah, *blah1L, explain[AIR_STRLEN_LARGE];
+ char *blah, *blah1L, explain[AIR_STRLEN_LARGE + 1];
size_t ii, blen;
ncopy = nrrdNew();
airMopAdd(mop, ncopy, (airMopper)nrrdNuke, airMopAlways);
- blen = AIR_STRLEN_HUGE*42;
+ blen = AIR_STRLEN_HUGE * 42;
blah = AIR_CALLOC(blen, char);
airMopAdd(mop, blah, airFree, airMopAlways);
- for (ii=0; ii<blen-1; ii++) {
+ for (ii = 0; ii < blen - 1; ii++) {
/* NOTE: a more rigorous test would put things in here that can't
be directly written to file, like \r \v \f, but fixing that bug
is enough of a significant change to functionality that it should
@@ -69,7 +69,7 @@
be discussed with users first */
blah[ii] = ("abcdefghijklmnopqrtsuvzwyz\n\"\\ "
"ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\"\\ ")
- [airRandInt((26 + 4)*2)]; /* 4 other characters */
+ [airRandInt((26 + 4) * 2)]; /* 4 other characters */
}
blah[ii] = '\0';
/* NOTE: this blah1L is to overcome a long-stanging bug that \n's
@@ -82,48 +82,49 @@
work */
blah1L = airOneLinify(airStrdup(blah));
airMopAdd(mop, blah1L, airFree, airMopAlways);
- nrrdAxisInfoSet_va(nin, nrrdAxisInfoLabel,
- "first axis label", "2nd axis label",
+ nrrdAxisInfoSet_va(nin, nrrdAxisInfoLabel, "first axis label", "2nd axis label",
blah1L);
nin->spaceUnits[0] = airOneLinify(airStrdup("\nsp\"\nu0\n"));
nin->spaceUnits[1] = airStrdup("bob");
- nin->spaceUnits[2] = airStrdup(blah1L); /* see NOTE above */
+ nin->spaceUnits[2] = airStrdup(blah1L); /* see NOTE above */
if (nrrdCommentAdd(nin, "the first comment")
- || nrrdCommentAdd(nin, "very long comment follows")
- || nrrdCommentAdd(nin, blah)
+ || nrrdCommentAdd(nin, "very long comment follows") || nrrdCommentAdd(nin, blah)
|| nrrdKeyValueAdd(nin, "first key", "first value")
|| nrrdKeyValueAdd(nin, "2nd key", "2nd value")
|| nrrdKeyValueAdd(nin, "big key", blah)) {
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
- fprintf(stderr, "%s: trouble w/ comments or KVPs:\n%s",
- me, err);
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: trouble w/ comments or KVPs:\n%s", me, err);
+ airMopError(mop);
+ return 1;
}
if (nrrdCopy(ncopy, nin)
- || nrrdCompare(nin, ncopy, AIR_FALSE /* onlyData */,
- 0.0 /* epsilon */, &differ, explain)) {
+ || nrrdCompare(nin, ncopy, AIR_FALSE /* onlyData */, 0.0 /* epsilon */, &differ,
+ explain)) {
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble w/ copy or compare:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (differ) {
fprintf(stderr, "%s: difference in in-memory copy: %s\n", me, explain);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
- if (nrrdSave("tloadTest.nrrd", nin, NULL)
- || nrrdLoad(ncopy, "tloadTest.nrrd", NULL)
- || nrrdCompare(nin, ncopy, AIR_FALSE /* onlyData */,
- 0.0 /* epsilon */, &differ, explain)) {
+ if (nrrdSave("tloadTest.nrrd", nin, NULL) || nrrdLoad(ncopy, "tloadTest.nrrd", NULL)
+ || nrrdCompare(nin, ncopy, AIR_FALSE /* onlyData */, 0.0 /* epsilon */, &differ,
+ explain)) {
char *err;
airMopAdd(mop, err = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: trouble w/ save, load, compare:\n%s\n", me, err);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (differ) {
fprintf(stderr, "%s: difference in on-disk copy: %s\n", me, explain);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
Modified: teem/trunk/Testing/nrrd/tskip.c
===================================================================
--- teem/trunk/Testing/nrrd/tskip.c 2024-07-17 17:48:07 UTC (rev 7214)
+++ teem/trunk/Testing/nrrd/tskip.c 2024-07-17 17:50:48 UTC (rev 7215)
@@ -43,7 +43,7 @@
main(int argc, const char **argv) {
/* stock variables */
char me[] = BKEY;
- hestOpt *hopt=NULL;
+ hestOpt *hopt = NULL;
hestParm *hparm;
airArray *mop;
/* variables specific to this program */
@@ -51,7 +51,7 @@
Nrrd *nref, *nin;
size_t *size, ii, nn, tick, pad[2];
unsigned int axi, refCRC, gotCRC, sizeNum;
- char *berr, *outS[2], stmp[AIR_STRLEN_SMALL], doneStr[AIR_STRLEN_SMALL];
+ char *berr, *outS[2], stmp[AIR_STRLEN_SMALL + 1], doneStr[AIR_STRLEN_SMALL + 1];
airRandMTState *rng;
unsigned int seed, *rdata, printbytes;
unsigned char *dataUC;
@@ -63,8 +63,7 @@
hparm = hestParmNew();
airMopAdd(mop, hparm, (airMopper)hestParmFree, airMopAlways);
/* learn things from hest */
- hestOptAdd(&hopt, "seed", "N", airTypeUInt, 1, 1, &seed, "42",
- "seed for RNG");
+ hestOptAdd(&hopt, "seed", "N", airTypeUInt, 1, 1, &seed, "42", "seed for RNG");
hestOptAdd(&hopt, "s", "sz0", airTypeSize_t, 1, -1, &size, NULL,
"sizes of desired output", &sizeNum);
hestOptAdd(&hopt, "p", "pb pa", airTypeSize_t, 2, 2, pad, "0 0",
@@ -75,10 +74,10 @@
hestOptAdd(&hopt, "pb", "print", airTypeUInt, 1, 1, &printbytes, "0",
"bytes to print at beginning and end of data, to help "
"debug problems");
- hestOptAdd(&hopt, "o", "out.data out.nhdr", airTypeString, 2, 2,
- outS, NULL, "output filenames of data and header");
- hestParseOrDie(hopt, argc-1, argv+1, hparm, me, tskipInfo,
- AIR_TRUE, AIR_TRUE, AIR_TRUE);
+ hestOptAdd(&hopt, "o", "out.data out.nhdr", airTypeString, 2, 2, outS, NULL,
+ "output filenames of data and header");
+ hestParseOrDie(hopt, argc - 1, argv + 1, hparm, me, tskipInfo, AIR_TRUE, AIR_TRUE,
+ AIR_TRUE);
airMopAdd(mop, hopt, (airMopper)hestOptFree, airMopAlways);
airMopAdd(mop, hopt, (airMopper)hestParseFree, airMopAlways);
@@ -86,19 +85,21 @@
nref = nrrdNew();
airMopAdd(mop, nref, (airMopper)nrrdNuke, airMopAlways);
if (nrrdMaybeAlloc_nva(nref, nrrdTypeUInt, sizeNum, size)) {
- airMopAdd(mop, berr=biffGetDone(NRRD), airFree, airMopAlways);
+ airMopAdd(mop, berr = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: error allocating data: %s\n", me, berr);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
rng = airRandMTStateNew(seed);
airMopAdd(mop, rng, (airMopper)airRandMTStateNix, airMopAlways);
nn = nrrdElementNumber(nref);
rdata = AIR_CAST(unsigned int *, nref->data);
- fprintf(stderr, "generating data: . . . "); fflush(stderr);
+ fprintf(stderr, "generating data: . . . ");
+ fflush(stderr);
time0 = airTime();
progress = AIR_FALSE;
- tick = nn/100;
- for (ii=0; ii<nn; ii++) {
+ tick = nn / 100;
+ for (ii = 0; ii < nn; ii++) {
rdata[ii] = airUIrandMT_r(rng);
if (ii && tick && !(ii % tick)) {
time1 = airTime();
@@ -108,77 +109,85 @@
progress = AIR_TRUE;
}
if (progress) {
- fprintf(stderr, "%s", airDoneStr(0, ii, nn, doneStr)); fflush(stderr);
+ fprintf(stderr, "%s", airDoneStr(0, ii, nn, doneStr));
+ fflush(stderr);
}
}
}
if (progress) {
- fprintf(stderr, "%s\n", airDoneStr(0, ii, nn, doneStr)); fflush(stderr);
+ fprintf(stderr, "%s\n", airDoneStr(0, ii, nn, doneStr));
+ fflush(stderr);
} else {
fprintf(stderr, "\n");
}
- fprintf(stderr, "finding reference (big-endian) CRC: "); fflush(stderr);
+ fprintf(stderr, "finding reference (big-endian) CRC: ");
+ fflush(stderr);
refCRC = nrrdCRC32(nref, airEndianBig);
fprintf(stderr, "%u\n", refCRC);
/* write data, with padding */
- fprintf(stderr, "saving data . . . "); fflush(stderr);
+ fprintf(stderr, "saving data . . . ");
+ fflush(stderr);
if (!(fout = fopen(outS[0], "wb" COMMIT))) {
- fprintf(stderr, "\n%s: couldn't open %s for writing: %s\n", me,
- outS[0], strerror(errno));
- airMopError(mop); return 1;
+ fprintf(stderr, "\n%s: couldn't open %s for writing: %s\n", me, outS[0],
+ strerror(errno));
+ airMopError(mop);
+ return 1;
}
airMopAdd(mop, fout, (airMopper)airFclose, airMopAlways);
- for (ii=0; ii<pad[0]; ii++) {
+ for (ii = 0; ii < pad[0]; ii++) {
if (EOF == fputc(1, fout)) {
fprintf(stderr, "\n%s: error doing pre-padding\n", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
if (nn != fwrite(nref->data, nrrdElementSize(nref), nn, fout)) {
fprintf(stderr, "\n%s: error writing data\n", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
- for (ii=0; ii<pad[1]; ii++) {
+ for (ii = 0; ii < pad[1]; ii++) {
if (EOF == fputc(2, fout)) {
fprintf(stderr, "\n%s: error doing post-padding\n", me);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
}
if (EOF == fflush(fout)) {
- fprintf(stderr, "\n%s: error fflushing data: %s\n", me,
- strerror(errno));
+ fprintf(stderr, "\n%s: error fflushing data: %s\n", me, strerror(errno));
}
fprintf(stderr, "\n");
if (printbytes) {
size_t bi, rpb, local_nn;
- char local_stmp[AIR_STRLEN_SMALL];
- local_nn = nrrdElementSize(nref)*nrrdElementNumber(nref);
+ char local_stmp[AIR_STRLEN_SMALL + 1];
+ local_nn = nrrdElementSize(nref) * nrrdElementNumber(nref);
rpb = AIR_MIN(printbytes, local_nn);
dataUC = AIR_CAST(unsigned char *, nref->data);
fprintf(stderr, "CORRECT %s bytes at beginning:\n",
airSprintSize_t(local_stmp, rpb));
- for (bi=0; bi<rpb; bi++) {
+ for (bi = 0; bi < rpb; bi++) {
fprintf(stderr, "%x ", dataUC[bi]);
}
fprintf(stderr, "...\n");
- fprintf(stderr, "CORRECT %s bytes at end:\n",
- airSprintSize_t(local_stmp, rpb));
+ fprintf(stderr, "CORRECT %s bytes at end:\n", airSprintSize_t(local_stmp, rpb));
fprintf(stderr, "...");
- for (bi=local_nn - rpb; bi<local_nn; bi++) {
+ for (bi = local_nn - rpb; bi < local_nn; bi++) {
fprintf(stderr, " %x", dataUC[bi]);
}
fprintf(stderr, "\n");
}
airMopSingleOkay(mop, fout);
- airMopSingleOkay(mop, nref); nref = NULL;
+ airMopSingleOkay(mop, nref);
+ nref = NULL;
/* write header; for now just writing the header directly */
fprintf(stderr, "writing header . . . \n");
if (!(fout = fopen(outS[1], "w"))) {
- fprintf(stderr, "%s: couldn't open %s for writing: %s\n", me,
- outS[1], strerror(errno));
- airMopError(mop); return 1;
+ fprintf(stderr, "%s: couldn't open %s for writing: %s\n", me, outS[1],
+ strerror(errno));
+ airMopError(mop);
+ return 1;
}
airMopAdd(mop, fout, (airMopper)airFclose, airMopAlways);
fprintf(fout, "NRRD0005\n");
@@ -185,19 +194,18 @@
fprintf(fout, "type: unsigned int\n");
fprintf(fout, "dimension: %u\n", sizeNum);
fprintf(fout, "sizes:");
- for (axi=0; axi<sizeNum; axi++) {
+ for (axi = 0; axi < sizeNum; axi++) {
fprintf(fout, " %s", airSprintSize_t(stmp, size[axi]));
}
fprintf(fout, "\n");
fprintf(fout, "endian: %s\n", airEnumStr(airEndian, airMyEndian()));
- fprintf(fout, "encoding: %s\n", airEnumStr(nrrdEncodingType,
- nrrdEncodingTypeRaw));
+ fprintf(fout, "encoding: %s\n", airEnumStr(nrrdEncodingType, nrrdEncodingTypeRaw));
if (!negskip) {
if (pad[0]) {
fprintf(fout, "byte skip: %s\n", airSprintSize_t(stmp, pad[0]));
}
} else {
- fprintf(fout, "byte skip: -%s\n", airSprintSize_t(stmp, pad[1]+1));
+ fprintf(fout, "byte skip: -%s\n", airSprintSize_t(stmp, pad[1] + 1));
}
fprintf(fout, "data file: %s\n", outS[0]);
airMopSingleOkay(mop, fout);
@@ -207,26 +215,25 @@
nin = nrrdNew();
airMopAdd(mop, nin, (airMopper)nrrdNuke, airMopAlways);
if (nrrdLoad(nin, outS[1], NULL)) {
- airMopAdd(mop, berr=biffGetDone(NRRD), airFree, airMopAlways);
+ airMopAdd(mop, berr = biffGetDone(NRRD), airFree, airMopAlways);
fprintf(stderr, "%s: error reading back in: %s\n", me, berr);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
if (printbytes) {
size_t bi, rpb, local_nn;
- char local_stmp[AIR_STRLEN_SMALL];
- local_nn = nrrdElementSize(nin)*nrrdElementNumber(nin);
+ char local_stmp[AIR_STRLEN_SMALL + 1];
+ local_nn = nrrdElementSize(nin) * nrrdElementNumber(nin);
rpb = AIR_MIN(printbytes, local_nn);
dataUC = AIR_CAST(unsigned char *, nin->data);
- fprintf(stderr, "FOUND %s bytes at beginning:\n",
- airSprintSize_t(local_stmp, rpb));
- for (bi=0; bi<rpb; bi++) {
+ fprintf(stderr, "FOUND %s bytes at beginning:\n", airSprintSize_t(local_stmp, rpb));
+ for (bi = 0; bi < rpb; bi++) {
fprintf(stderr, "%x ", dataUC[bi]);
}
fprintf(stderr, "...\n");
- fprintf(stderr, "FOUND %s bytes at end:\n",
- airSprintSize_t(local_stmp, rpb));
+ fprintf(stderr, "FOUND %s bytes at end:\n", airSprintSize_t(local_stmp, rpb));
fprintf(stderr, "...");
- for (bi=local_nn - rpb; bi<local_nn; bi++) {
+ for (bi = local_nn - rpb; bi < local_nn; bi++) {
fprintf(stderr, " %x", dataUC[bi]);
}
fprintf(stderr, "\n");
@@ -235,7 +242,8 @@
gotCRC = nrrdCRC32(nin, airEndianBig);
if (refCRC != gotCRC) {
fprintf(stderr, "%s: got CRC %u but wanted %u\n", me, gotCRC, refCRC);
- airMopError(mop); return 1;
+ airMopError(mop);
+ return 1;
}
fprintf(stderr, "(all ok)\n");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-17 17:48:08
|
Revision: 7214
http://sourceforge.net/p/teem/code/7214
Author: kindlmann
Date: 2024-07-17 17:48:07 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
fixing uses of AIR_STRLEN_x plus clang-format
Modified Paths:
--------------
teem/trunk/Testing/air/amath.c
teem/trunk/Testing/air/pptest.c
teem/trunk/Testing/air/strtok.c
Modified: teem/trunk/Testing/air/amath.c
===================================================================
--- teem/trunk/Testing/air/amath.c 2024-07-17 17:45:47 UTC (rev 7213)
+++ teem/trunk/Testing/air/amath.c 2024-07-17 17:48:07 UTC (rev 7214)
@@ -21,7 +21,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "teem/air.h"
/*
@@ -31,7 +30,7 @@
int
main(int argc, const char *argv[]) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
airArray *mop;
AIR_UNUSED(argc);
@@ -43,15 +42,16 @@
size_t ee = 1;
do {
if (l2 != (ret = airLog2(ee))) {
- fprintf(stderr, "airLog2(%s) = %d != %d\n",
- airSprintSize_t(stmp, ee), ret, l2);
- airMopError(mop); return 1;
+ fprintf(stderr, "airLog2(%s) = %d != %d\n", airSprintSize_t(stmp, ee), ret, l2);
+ airMopError(mop);
+ return 1;
}
if (ee > 1) {
- if (-1 != (ret = airLog2(ee+1))) {
- fprintf(stderr, "airLog2(%s) = %d != -1\n",
- airSprintSize_t(stmp, ee+1), ret);
- airMopError(mop); return 1;
+ if (-1 != (ret = airLog2(ee + 1))) {
+ fprintf(stderr, "airLog2(%s) = %d != -1\n", airSprintSize_t(stmp, ee + 1),
+ ret);
+ airMopError(mop);
+ return 1;
}
}
l2 += 1;
@@ -66,21 +66,21 @@
rng = airRandMTStateNew(4242);
airMopAdd(mop, rng, (airMopper)airRandMTStateNix, airMopAlways);
error = 0;
- for (ti=0; ti<testnum; ti++) {
+ for (ti = 0; ti < testnum; ti++) {
double dif;
- airNormalRand_r(aa+0, aa+1, rng);
- for (pi=0; pi<2; pi++) {
+ airNormalRand_r(aa + 0, aa + 1, rng);
+ for (pi = 0; pi < 2; pi++) {
aa[pi] *= 10000;
uu = airCbrt(aa[pi]);
- dif = fabs(aa[pi] - uu*uu*uu);
- error += (dif/aa[pi])*dif;
+ dif = fabs(aa[pi] - uu * uu * uu);
+ error += (dif / aa[pi]) * dif;
}
}
error /= testnum;
if (error > eps) {
- fprintf(stderr, "average cbrt error was %.17g > eps %0.17g\n",
- error, eps);
- airMopError(mop); return 1;
+ fprintf(stderr, "average cbrt error was %.17g > eps %0.17g\n", error, eps);
+ airMopError(mop);
+ return 1;
} else {
fprintf(stderr, "average cbrt error = %.17g\n", error);
}
@@ -88,6 +88,3 @@
exit(0);
}
-
-
-
Modified: teem/trunk/Testing/air/pptest.c
===================================================================
--- teem/trunk/Testing/air/pptest.c 2024-07-17 17:45:47 UTC (rev 7213)
+++ teem/trunk/Testing/air/pptest.c 2024-07-17 17:48:07 UTC (rev 7214)
@@ -21,7 +21,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "teem/air.h"
/*
@@ -35,7 +34,7 @@
const char *me;
size_t sz;
ptrdiff_t pd;
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
AIR_UNUSED(argc);
me = argv[0];
@@ -56,6 +55,3 @@
exit(0);
}
-
-
-
Modified: teem/trunk/Testing/air/strtok.c
===================================================================
--- teem/trunk/Testing/air/strtok.c 2024-07-17 17:45:47 UTC (rev 7213)
+++ teem/trunk/Testing/air/strtok.c 2024-07-17 17:48:07 UTC (rev 7214)
@@ -21,7 +21,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "teem/air.h"
/*
@@ -39,27 +38,24 @@
main(int argc, const char *argv[]) {
airArray *mop;
const char *me;
- const char *word[] = {
- "There's", "a", "certain", "slant", "of", "light",
- "On", "winter", "afternoons",
- "That", "oppresses,", "like", "the", "weight",
- "Of", "cathedral", "tunes.",
- "Heavenly", "hurt", "it", "gives", "us;",
- "We", "can", "find", "no", "scar,",
- "But", "internal", "difference",
- "Where", "the", "meanings", "are.",
- "None", "may", "teach", "it", "anything,",
- "'T", "is", "the", "seal,", "despair,",
- "An", "imperial", "affliction",
- "Sent", "us", "of", "the", "air.",
- "When", "it", "comes,", "the", "landscape", "listens,",
- "Shadows", "hold", "their", "breath;",
- "When", "it", "goes,", "'t", "is", "like", "the", "distance",
- "On", "the", "look", "of", "death.", ""};
+ const char *word[]
+ = {"There's", "a", "certain", "slant", "of", "light",
+ "On", "winter", "afternoons", "That", "oppresses,", "like",
+ "the", "weight", "Of", "cathedral", "tunes.", "Heavenly",
+ "hurt", "it", "gives", "us;", "We", "can",
+ "find", "no", "scar,", "But", "internal", "difference",
+ "Where", "the", "meanings", "are.", "None", "may",
+ "teach", "it", "anything,", "'T", "is", "the",
+ "seal,", "despair,", "An", "imperial", "affliction", "Sent",
+ "us", "of", "the", "air.", "When", "it",
+ "comes,", "the", "landscape", "listens,", "Shadows", "hold",
+ "their", "breath;", "When", "it", "goes,", "'t",
+ "is", "like", "the", "distance", "On", "the",
+ "look", "of", "death.", ""};
const char *sep = " \t\n_", *ww;
unsigned int wi, sepLen, lineLen, wordNum;
airArray *lineArr;
- char wordsp[AIR_STRLEN_MED], *line, *last=NULL;
+ char wordsp[AIR_STRLEN_MED + 1], *line, *last = NULL;
AIR_UNUSED(argc);
me = argv[0];
@@ -66,7 +62,7 @@
sepLen = AIR_CAST(unsigned int, airStrlen(sep));
mop = airMopNew();
- lineArr = airArrayNew((void**)(&line), &lineLen, sizeof(char), INCR);
+ lineArr = airArrayNew((void **)(&line), &lineLen, sizeof(char), INCR);
airMopAdd(mop, lineArr, (airMopper)airArrayNuke, airMopAlways);
/* initialize line with "" */
@@ -74,7 +70,7 @@
strcpy(line, "");
/* add words and separators onto line */
- for (wi=0; airStrlen(word[wi]); wi++) {
+ for (wi = 0; airStrlen(word[wi]); wi++) {
sprintf(wordsp, "%s%c", word[wi], sep[AIR_MOD(wi, sepLen)]);
airArrayLenIncr(lineArr, AIR_CAST(int, airStrlen(wordsp)));
strcat(line, wordsp);
@@ -81,7 +77,7 @@
}
/* lose last sep char */
- line[strlen(line)-1] = '\0';
+ line[strlen(line) - 1] = '\0';
/* start tokenizing and comparing */
wordNum = airStrntok(line, sep);
@@ -91,12 +87,9 @@
return 1;
}
wi = 0;
- for (ww = airStrtok(line, sep, &last);
- ww;
- ww = airStrtok(NULL, sep, &last)) {
+ for (ww = airStrtok(line, sep, &last); ww; ww = airStrtok(NULL, sep, &last)) {
if (strcmp(word[wi], ww)) {
- fprintf(stderr, "%s: word[%u] |%s| != parsed |%s|\n",
- me, wi, word[wi], ww);
+ fprintf(stderr, "%s: word[%u] |%s| != parsed |%s|\n", me, wi, word[wi], ww);
airMopError(mop);
exit(1);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-17 17:45:50
|
Revision: 7213
http://sourceforge.net/p/teem/code/7213
Author: kindlmann
Date: 2024-07-17 17:45:47 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
fixing use of AIR_STRLEN_SMALL
Modified Paths:
--------------
teem/trunk/Testing/air/miscAir.c
Modified: teem/trunk/Testing/air/miscAir.c
===================================================================
--- teem/trunk/Testing/air/miscAir.c 2024-07-17 15:55:04 UTC (rev 7212)
+++ teem/trunk/Testing/air/miscAir.c 2024-07-17 17:45:47 UTC (rev 7213)
@@ -175,7 +175,7 @@
/* airPrettySprintSize_t */
{
- char prstmp[AIR_STRLEN_SMALL];
+ char prstmp[AIR_STRLEN_SMALL + 1];
size_t vals[] = {0, /* 0 */
800, /* 1 */
1024, /* 2 = 2^10 */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kin...@us...> - 2024-07-17 15:55:07
|
Revision: 7212
http://sourceforge.net/p/teem/code/7212
Author: kindlmann
Date: 2024-07-17 15:55:04 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
synching with source
Modified Paths:
--------------
teem/trunk/python/cffi/biffdata/limn.csv
teem/trunk/python/cffi/teem.py
Modified: teem/trunk/python/cffi/biffdata/limn.csv
===================================================================
--- teem/trunk/python/cffi/biffdata/limn.csv 2024-07-16 23:00:09 UTC (rev 7211)
+++ teem/trunk/python/cffi/biffdata/limn.csv 2024-07-17 15:55:04 UTC (rev 7212)
@@ -61,13 +61,13 @@
limnSplineTypeSpecParse,limnSplineTypeSpec *,NULL,0,limn,limn/splineMisc.c:222
limnSplineParse,limnSpline *,NULL,0,limn,limn/splineMisc.c:278
limnCbfPointsNew,limnCbfPoints *,NULL,0,limn,limn/splineFit.c:175
-limnCbfPointsCheck,int,1,0,limn,limn/splineFit.c:229
-limnCbfCtxPrep,int,1,0,limn,limn/splineFit.c:497
-limnCbfTVT,int,1,0,limn,limn/splineFit.c:762
-limnCbfSingle,int,1,0,limn,limn/splineFit.c:1494
-limnCbfCorners,int,1,0,limn,limn/splineFit.c:1545
-limnCbfMulti,int,1,0,limn,limn/splineFit.c:1727
-limnCbfGo,int,1,0,limn,limn/splineFit.c:1844
+limnCbfPointsCheck,int,1,0,limn,limn/splineFit.c:247
+limnCbfCtxPrep,int,1,0,limn,limn/splineFit.c:515
+limnCbfTVT,int,1,0,limn,limn/splineFit.c:783
+limnCbfSingle,int,1,0,limn,limn/splineFit.c:1511
+limnCbfCorners,int,1,0,limn,limn/splineFit.c:1562
+limnCbfMulti,int,1,0,limn,limn/splineFit.c:1745
+limnCbfGo,int,1,0,limn,limn/splineFit.c:1863
limnObjectWorldHomog,int,1,0,limn,limn/transform.c:25
limnObjectFaceNormals,int,1,0,limn,limn/transform.c:47
limnObjectSpaceTransform,int,1,0,limn,limn/transform.c:210
Modified: teem/trunk/python/cffi/teem.py
===================================================================
--- teem/trunk/python/cffi/teem.py 2024-07-16 23:00:09 UTC (rev 7211)
+++ teem/trunk/python/cffi/teem.py 2024-07-17 15:55:04 UTC (rev 7212)
@@ -434,13 +434,13 @@
'limnSplineTypeSpecParse': (_equals_null, 0, b'limn', 'limn/splineMisc.c:222'),
'limnSplineParse': (_equals_null, 0, b'limn', 'limn/splineMisc.c:278'),
'limnCbfPointsNew': (_equals_null, 0, b'limn', 'limn/splineFit.c:175'),
- 'limnCbfPointsCheck': (_equals_one, 0, b'limn', 'limn/splineFit.c:229'),
- 'limnCbfCtxPrep': (_equals_one, 0, b'limn', 'limn/splineFit.c:497'),
- 'limnCbfTVT': (_equals_one, 0, b'limn', 'limn/splineFit.c:762'),
- 'limnCbfSingle': (_equals_one, 0, b'limn', 'limn/splineFit.c:1494'),
- 'limnCbfCorners': (_equals_one, 0, b'limn', 'limn/splineFit.c:1545'),
- 'limnCbfMulti': (_equals_one, 0, b'limn', 'limn/splineFit.c:1727'),
- 'limnCbfGo': (_equals_one, 0, b'limn', 'limn/splineFit.c:1844'),
+ 'limnCbfPointsCheck': (_equals_one, 0, b'limn', 'limn/splineFit.c:247'),
+ 'limnCbfCtxPrep': (_equals_one, 0, b'limn', 'limn/splineFit.c:515'),
+ 'limnCbfTVT': (_equals_one, 0, b'limn', 'limn/splineFit.c:783'),
+ 'limnCbfSingle': (_equals_one, 0, b'limn', 'limn/splineFit.c:1511'),
+ 'limnCbfCorners': (_equals_one, 0, b'limn', 'limn/splineFit.c:1562'),
+ 'limnCbfMulti': (_equals_one, 0, b'limn', 'limn/splineFit.c:1745'),
+ 'limnCbfGo': (_equals_one, 0, b'limn', 'limn/splineFit.c:1863'),
'limnObjectWorldHomog': (_equals_one, 0, b'limn', 'limn/transform.c:25'),
'limnObjectFaceNormals': (_equals_one, 0, b'limn', 'limn/transform.c:47'),
'limnObjectSpaceTransform': (_equals_one, 0, b'limn', 'limn/transform.c:210'),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|