sbonaretti / pyKNEEr

An image analysis workflow for open and reproducible research on femoral knee cartilage
https://sbonaretti.github.io/pyKNEEr/
GNU General Public License v3.0
32 stars 11 forks source link

morphology_functions.py question? #18

Open ylim99 opened 5 hours ago

ylim99 commented 5 hours ago

HI,

Do you know why I will receive the below error message with 01_cubeQuant_01_prep_fc.mha, there is no problem with 01_DESS_01_prep_fc.mha.

With 01_cubeQuant_01_prep_fc.mha (but not 01_DESS_01_prep_fc.mha), I will see Somewhere around line 218 within morphology_functions.py, temp = np.array(temp)

with the error message of ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

If I use temp = np.array(temp, dtype=object), (which I do not think is the solution), but there will be problems with numpy float error later for both
File "C:\Users\NAME\Downloads\pyKNEEr-master\pyKNEEr-master\pykneer1\venv\Lib\site-packages\pykneer\morphology_functions.py", line 387, in flatten_surface phi = np.arctan2(pts[:,2], pts[:,1]) # default ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'float' object has no attribute 'arctan2'

ylim99 commented 5 hours ago

I think the issue with 01_cubeQuant_01_prep_fc.mha lies with array within array, and hence the inhomogeneous array.

Hope that you can shed some lights on how I should solve this? Thank you.

[array([[271.5, 307. ], [271. , 306.5], [270. , 306.5], [269. , 306.5], [268.5, 307. ], [268. , 307.5], [267.5, 308. ], [267. , 308.5], [266.5, 309. ], [266. , 309.5], [265. , 309.5], [264. , 309.5], [263.5, 310. ], [263. , 310.5], [262.5, 311. ], [262. , 311.5], [261. , 311.5], [260.5, 312. ], [260. , 312.5], [259. , 312.5], [258. , 312.5], [257. , 312.5], [256. , 312.5], [255. , 312.5], [254.5, 313. ], [254. , 313.5], [253. , 313.5], [252. , 313.5], [251.5, 314. ], [251. , 314.5], [250. , 314.5], [249. , 314.5], [248. , 314.5], [247. , 314.5], [246.5, 315. ], [246. , 315.5], [245. , 315.5], [244. , 315.5], [243. , 315.5], [242. , 315.5], [241. , 315.5], [240. , 315.5], [239. , 315.5], [238. , 315.5], [237. , 315.5], [236. , 315.5], [235. , 315.5], [234. , 315.5], [233. , 315.5], [232.5, 315. ], [232. , 314.5], [231. , 314.5], [230. , 314.5], [229.5, 314. ], [229. , 313.5], [228. , 313.5], [227. , 313.5], [226. , 313.5], [225.5, 313. ], [225. , 312.5], [224. , 312.5], [223. , 312.5], [222.5, 312. ], [222. , 311.5], [221.5, 311. ], [221. , 310.5], [220. , 310.5], [219. , 310.5], [218. , 310.5], [217.5, 310. ], [217. , 309.5], [216.5, 309. ], [216. , 308.5], [215.5, 308. ], [215. , 307.5], [214. , 307.5], [213.5, 307. ], [213. , 306.5], [212. , 306.5], [211.5, 306. ], [211. , 305.5], [210.5, 305. ], [210. , 304.5], [209.5, 304. ], [209. , 303.5], [208. , 303.5], [207.5, 303. ], [207.5, 302. ], [207. , 301.5], [206. , 301.5], [205.5, 301. ], [205. , 300.5], [204.5, 300. ], [204. , 299.5], [203.5, 299. ], [203.5, 298. ], [203. , 297.5], [202.5, 297. ], [202. , 296.5], [201.5, 296. ], [201. , 295.5], [200.5, 295. ], [200. , 294.5], [199.5, 294. ], [199. , 293.5], [198.5, 293. ], [198.5, 292. ], [198. , 291.5], [197.5, 291. ], [197. , 290.5], [196.5, 290. ], [196.5, 289. ], [196. , 288.5], [195.5, 288. ], [195. , 287.5], [194. , 287.5], [193.5, 287. ], [193.5, 286. ], [193. , 285.5], [192.5, 285. ], [192.5, 284. ], [192. , 283.5], [191.5, 283. ], [191.5, 282. ], [191. , 281.5], [190.5, 281. ], [190. , 280.5], [189.5, 281. ], [189. , 281.5], [188.5, 282. ], [189. , 282.5], [190. , 282.5], [190.5, 283. ], [190.5, 284. ], [191. , 284.5], [191.5, 285. ], [191.5, 286. ], [192. , 286.5], [192.5, 287. ], [192.5, 288. ], [192.5, 289. ], [193. , 289.5], [193.5, 290. ], [193. , 290.5], [192.5, 291. ], [193. , 291.5], [193.5, 292. ], [193.5, 293. ], [194. , 293.5], [194.5, 293. ], [195. , 292.5], [195.5, 293. ], [195. , 293.5], [194.5, 294. ], [194.5, 295. ], [194.5, 296. ], [195. , 296.5], [195.5, 297. ], [196. , 297.5], [197. , 297.5], [197.5, 298. ], [197.5, 299. ], [198. , 299.5], [198.5, 300. ], [199. , 300.5], [199.5, 301. ], [199.5, 302. ], [200. , 302.5], [200.5, 303. ], [201. , 303.5], [201.5, 304. ], [202. , 304.5], [202.5, 305. ], [203. , 305.5], [203.5, 306. ], [204. , 306.5], [204.5, 307. ], [205. , 307.5], [205.5, 308. ], [206. , 308.5], [207. , 308.5], [207.5, 309. ], [207.5, 310. ], [208. , 310.5], [208.5, 311. ], [209. , 311.5], [210. , 311.5], [210.5, 312. ], [211. , 312.5], [212. , 312.5], [212.5, 313. ], [213. , 313.5], [213.5, 314. ], [214. , 314.5], [215. , 314.5], [215.5, 315. ], [216. , 315.5], [217. , 315.5], [217.5, 316. ], [218. , 316.5], [218.5, 317. ], [219. , 317.5], [220. , 317.5], [221. , 317.5], [221.5, 318. ], [222. , 318.5], [222.5, 319. ], [223. , 319.5], [224. , 319.5], [225. , 319.5], [226. , 319.5], [226.5, 320. ], [227. , 320.5], [227.5, 321. ], [228. , 321.5], [229. , 321.5], [229.5, 322. ], [230. , 322.5], [231. , 322.5], [232. , 322.5], [233. , 322.5], [234. , 322.5], [235. , 322.5], [235.5, 323. ], [236. , 323.5], [237. , 323.5], [238. , 323.5], [239. , 323.5], [240. , 323.5], [241. , 323.5], [242. , 323.5], [243. , 323.5], [244. , 323.5], [244.5, 323. ], [245. , 322.5], [246. , 322.5], [247. , 322.5], [248. , 322.5], [249. , 322.5], [250. , 322.5], [250.5, 322. ], [251. , 321.5], [252. , 321.5], [252.5, 321. ], [253. , 320.5], [254. , 320.5], [255. , 320.5], [255.5, 320. ], [256. , 319.5], [256.5, 319. ], [257. , 318.5], [257.5, 318. ], [258. , 317.5], [258.5, 317. ], [259. , 316.5], [260. , 316.5], [260.5, 316. ], [261. , 315.5], [261.5, 315. ], [262. , 314.5], [262.5, 314. ], [263. , 313.5], [264. , 313.5], [264.5, 313. ], [265. , 312.5], [265.5, 312. ], [266. , 311.5], [266.5, 311. ], [267. , 310.5], [268. , 310.5], [268.5, 310. ], [269. , 309.5], [269.5, 309. ], [270. , 308.5], [270.5, 308. ], [271. , 307.5], [271.5, 307. ]]), array([[197. , 296.5], [196.5, 296. ], [196. , 295.5], [195.5, 295. ], [196. , 294.5], [196.5, 295. ], [197. , 295.5], [197.5, 296. ], [197. , 296.5]])]