{"record":{"id":"c54ccbf875af9dab","repo":"Yalantis/uCrop","slug":"load-parrec-unsupported-d-bits-pixel-type-for","errorCode":null,"errorMessage":"load_parrec(): Unsupported %d-bits pixel type for file '%s'.","messagePattern":"load_parrec\\(\\): Unsupported (.+?)-bits pixel type for file '(.+?)'\\.","errorType":"exception","errorClass":"CImgIOException","httpStatus":null,"severity":"error","filePath":"ucrop/src/main/jni/CImg.h","lineNumber":67115,"sourceCode":"        } break;\n        case 16 : {\n          CImg<ushortT> buf(size_x,size_y);\n          cimg::fread(buf._data,size_x*size_y,file2);\n          if (cimg::endianness()) cimg::invert_endianness(buf._data,size_x*size_y);\n          CImg<T>& img = (*this)[imn];\n          cimg_forXY(img,x,y) img(x,y,sn) = (T)(( buf(x,y)*rs + ri )/(rs*ss));\n        } break;\n        case 32 : {\n          CImg<uintT> buf(size_x,size_y);\n          cimg::fread(buf._data,size_x*size_y,file2);\n          if (cimg::endianness()) cimg::invert_endianness(buf._data,size_x*size_y);\n          CImg<T>& img = (*this)[imn];\n          cimg_forXY(img,x,y) img(x,y,sn) = (T)(( buf(x,y)*rs + ri )/(rs*ss));\n        } break;\n        default :\n          cimg::fclose(file);\n          cimg::fclose(file2);\n          throw CImgIOException(_cimglist_instance\n                                \"load_parrec(): Unsupported %d-bits pixel type for file '%s'.\",\n                                cimglist_instance,\n                                pixsize,filename);\n        }\n      }\n      cimg::fclose(file);\n      cimg::fclose(file2);\n      if (!_width)\n        throw CImgIOException(_cimglist_instance\n                              \"load_parrec(): Failed to recognize valid PAR-REC data in file '%s'.\",\n                              cimglist_instance,\n                              filename);\n      return *this;\n    }\n\n    //! Load a list from a PAR/REC (Philips) file \\newinstance.\n    static CImgList<T> get_load_parrec(const char *const filename) {\n      return CImgList<T>().load_parrec(filename);","sourceCodeStart":67097,"sourceCodeEnd":67133,"githubUrl":"https://github.com/Yalantis/uCrop/blob/f788b534b48c144edf786c8cddbf0e029e637804/ucrop/src/main/jni/CImg.h#L67097-L67133","documentation":"load_parrec() reads the pixel size in bits ('pixsize') from the PAR file header and supports only the bit depths Philips PAR/REC defines. When the header declares an unsupported bit depth, CImg closes both open files (PAR and REC) and throws CImgIOException.","triggerScenarios":"load_parrec() on a PAR file whose header records a pixel bit size not matching any handled case (the standard 8/12/16/24/32-bit cases); a corrupted or non-standard PAR header; a PAR file from an unsupported scanner protocol.","commonSituations":"Files exported with non-standard reconstruction settings; hand-edited or truncated PAR headers; third-party tools writing PAR-like headers with unusual bit depths; scanner firmware producing newer/older formats than the bundled CImg supports.","solutions":["Check the 'Pixel size' / bits-per-pixel field in the PAR header; re-export the scan with a standard bit depth (8/16/32-bit)","Upgrade the CImg library version - newer versions support more PAR/REC bit depths","Convert the REC data externally (e.g. with dcm2nii or Philips tools) to a standard format (NIfTI/DICOM) and load that instead","Verify the PAR file is complete and uncorrupted"],"exampleFix":"// before\nimgs.load_parrec(\"scan.par\"); // header says 20 bits\n// after\n// re-export scan with standard 16-bit reconstruction, then:\nimgs.load_parrec(\"scan_16bit.par\");","handlingStrategy":"try-catch","validationCode":"int bits = parseParPixelBits(path); // read bits/pixel from PAR header\nif (bits != 8 && bits != 16 && bits != 24 && bits != 32) { /* re-export or convert first */ }","typeGuard":null,"tryCatchPattern":"try { imgs.load_parrec(parPath); }\ncatch (CImgIOException& e) { fprintf(stderr, \"PAR/REC unsupported data: %s\\n\", e.what()); /* convert to NIfTI/DICOM */ }","preventionTips":["Keep scanner exports at standard bit depths","Pin a known-good CImg version compatible with your Philips release","Keep the original DICOM export as fallback"],"tags":["cimg","parrec","mri","unsupported-pixel-type","file-format"],"backgroundTag":"unsupported-dtype","analyzedSha":"f788b534b48c144edf786c8cddbf0e029e637804","analyzedAt":"2026-09-08T08:36:04.887Z","contentChangedAt":"2026-09-08T08:36:04.887Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}