[{"data":1,"prerenderedAt":339},["ShallowReactive",2],{"\u002Fprojects\u002Fmicrofluidics-gradient-analyzer":3,"$Xgs0RoTCP8":333},{"id":4,"title":5,"body":6,"date":317,"description":318,"extension":319,"image":320,"meta":321,"navigation":322,"path":323,"repository":324,"seo":327,"stem":328,"tags":329,"__hash__":332},"projects\u002Fprojects\u002Fmicrofluidics-gradient-analyzer.md","Microfluidics Gradient Analyzer",{"type":7,"value":8,"toc":301},"minimark",[9,42,47,60,68,74,80,136,139,169,172,182,188,199,204,207,210,213,220,224,227,230,237,248,252,255,259,262,266,278,281,285,288,294,297],[10,11,14,18],"card",{"icon":12,"title":13},"i-lucide-info","TL;DR",[15,16,17],"p",{},"Microfluidics Gradient Analyzer is a comprehensive pipeline written in R that includes two separate methods to quantify laminar flow in microfluidic devices under different flow rates.",[15,19,20,21,25,26,30,33,34,41],{},"The first method includes using the ",[22,23,24],"code",{},"magick:quantize"," function that the author utilized. The second method applies a ",[27,28],"span",{"style":29},"font-size: 14px; background-color: oklch(0.269 0 0);",[22,31,32],{},"Sobel-Kernel"," filter (commonly used in Edge-Detection systems) to quantify gradient, inspired by ",[35,36,40],"a",{"href":37,"rel":38},"https:\u002F\u002Fdoi.org\u002F10.3390\u002Fjimaging4060074",[39],"nofollow","this paper",".",[43,44,46],"h2",{"id":45},"laminar-flow","💦 Laminar Flow",[15,48,49,50,53,54,59],{},"Typically, at ",[22,51,52],{},"R \u003C 3000"," (Reynold's number), fluids exhibit ",[35,55,58],{"href":56,"rel":57},"https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FLaminar_flow",[39],"laminar flow",". Essentially, this means that instead of the fluid flowing in a chaotic, circular motion in turbulent flow, the liquids \"follow smooth paths in layers, with each layer moving smoothly past the adjacent layers with little or no mixing\" (Wikipedia). ",[43,61,63,64,67],{"id":62},"method-i-quantizedetection-system","Method I - ",[22,65,66],{},"Quantize"," Detection System",[69,70,71],"note",{},[15,72,73],{},"This algorithm was only developed by me as a fun test. It simplifies a lot of the aspects related to gradient analysis and is by no means comprehensive. However, it is still a fun experiment on data analysis that I did that could give some inspiration.",[15,75,76,77,79],{},"This system utilizes the ",[22,78,24],{}," function to select the top 50 most prominent colors in any particular section of the microfluidics device where the gradient is most prominent. ",[81,82,87],"pre",{"className":83,"code":84,"language":85,"meta":86,"style":86},"language-vue shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","palette \u003C- image_quantize(img, max = 50, colorspace = \"RGB\")\n","vue","",[22,88,89],{"__ignoreMap":86},[27,90,93,97,101,105,109,112,115,119,122,124,127,130,133],{"class":91,"line":92},"line",1,[27,94,96],{"class":95},"sTEyZ","palette ",[27,98,100],{"class":99},"sMK4o","\u003C",[27,102,104],{"class":103},"swJcz","-",[27,106,108],{"class":107},"spNyl"," image_quantize(img,",[27,110,111],{"class":107}," max",[27,113,114],{"class":99}," =",[27,116,118],{"class":117},"sfazB"," 50,",[27,120,121],{"class":107}," colorspace",[27,123,114],{"class":99},[27,125,126],{"class":99}," \"",[27,128,129],{"class":117},"RGB",[27,131,132],{"class":99},"\"",[27,134,135],{"class":107},")\n",[15,137,138],{},"The pixels are then extracted. ",[81,140,142],{"className":83,"code":141,"language":85,"meta":86,"style":86},"data \u003C- image_data(palette, channels = \"RGB\")\n",[22,143,144],{"__ignoreMap":86},[27,145,146,149,151,153,156,159,161,163,165,167],{"class":91,"line":92},[27,147,148],{"class":95},"data ",[27,150,100],{"class":99},[27,152,104],{"class":103},[27,154,155],{"class":107}," image_data(palette,",[27,157,158],{"class":107}," channels",[27,160,114],{"class":99},[27,162,126],{"class":99},[27,164,129],{"class":117},[27,166,132],{"class":99},[27,168,135],{"class":107},[15,170,171],{},"Then the number of unique pixels are counted. The higher the number of unique pixels, the more gradual the gradient, which reflects a higher flow rate. If the pixels are very similar, it would mean that the gradient was very abrupt, indicating a higher flow rate. ",[173,174,175],"warning",{},[15,176,177,178,41],{},"As you can see, there are key flaws within this algorithm. It doesn't take into account that very gradual gradients might have very similar pixels, resulting in a decrease in the number of unique pixels, ",[179,180,181],"em",{},"even after the preprocessing",[43,183,185,186,67],{"id":184},"method-ii-sobel-kerneldetection-system","Method II - ",[22,187,32],{},[15,189,190,191,193,194,198],{},"This algorithm is a lot more comprehensive than the ",[22,192,66],{}," detection system. It includes steps for normalization, Sobel convolution, gradient calculation, non-maximum suppression, and graphing with quantitative metrics. This was modified based on this paper ",[35,195,197],{"href":37,"rel":196},[39],"here",". ",[200,201,203],"h3",{"id":202},"step-1-image-normalization","Step 1: Image Normalization",[15,205,206],{},"In this step, the images were normalized in a three-part process.",[15,208,209],{},"The first part includes image scaling. Since the input images may have different x-values and y-values, they were all scaled to the same height (since height remains a more important factor of measure where vertical gradients are important). ",[15,211,212],{},"The second part includes grey-scaling. By grey-scaling the image, we can better observe this gradient change from green to red. This also allows the third step to be conducted more easily. ",[15,214,215,216,219],{},"The third part includes changing normalizing the illumination of the images, achieved through a function in the ",[22,217,218],{},"magick"," package. ",[200,221,223],{"id":222},"step-2-sobel-convolution","Step 2: Sobel Convolution",[15,225,226],{},"The Sobel operator is a convolution filter commonly used in edge-detection systems.",[15,228,229],{},"Edge-detection systems usually work by taking the partial derivatives of the change in color intensity in the x- and y-direction to find the local maxima or minima, and defines that as an edge. Convolution filters allow the partial derivatives to be approximated through the intensity of neighboring pixels. The tangent of the y-partial derivative over the x-partial derivative could also be calculated to determine the gradient direction. ",[15,231,232,233,236],{},"In our case, the",[22,234,235],{},"3x3 Sobel convolution filter","was chosen.",[69,238,239],{},[15,240,241,242,247],{},"More information on convolution filters can be found in ",[35,243,246],{"href":244,"rel":245},"https:\u002F\u002Fyoutu.be\u002FlOEBsQodtEQ?si=cIia9N8H189Hah-v",[39],"this video",", which helped me out a lot during my process of learning. ",[200,249,251],{"id":250},"step-3-non-maximum-suppression","Step 3: Non-maximum Suppression ",[15,253,254],{},"Since the Sobel operator is applied on every pixel on the image, we would need to extract prominent \"edges\" that can be used to determine the gradient. Hence, we refined our edge (gradient) detection system by only keeping local maxima. ",[200,256,258],{"id":257},"step-4-quantitative-metrics-graphing","Step 4: Quantitative Metrics & Graphing",[15,260,261],{},"We quantified the gradient by calculating the number of edge pixels, which reflected the intensity of the gradient. A gradual gradient would have a higher number of pixels since there would be more transitions. A shaper gradient would only have a few number of edge pixels since there would only be one sharp transition. Graphing was done by comparing flow-rate against the number of edge pixels. ",[43,263,265],{"id":264},"additional-information","Additional Information",[15,267,268,269,273,274,277],{},"This project was developed for the ",[270,271,272],"strong",{},"Nanotechnology"," course at the ",[270,275,276],{},"Engineering Summer Academy at Penn"," summer program that I took during the summer of 2025.",[15,279,280],{},"More pictures and information will be added to this page as I slowly organize them. ",[43,282,284],{"id":283},"disclaimer","Disclaimer",[15,286,287],{},"This pipeline was developed for educational purposes as part of the Engineering Summer Academy at Penn (summer 2025). Both methods are experimental and have known limitations.",[15,289,290,293],{},[270,291,292],{},"This software is provided \"as-is\" without any warranty."," Users are solely responsible for validating results for their specific applications. The author(s) are not liable for any errors, inaccuracies, or damages arising from the use of this software.",[15,295,296],{},"For critical research applications, please independently verify all measurements and consult established methodologies in the field.",[298,299,300],"style",{},"html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":86,"searchDepth":302,"depth":302,"links":303},2,[304,305,307,315,316],{"id":45,"depth":302,"text":46},{"id":62,"depth":302,"text":306},"Method I - Quantize Detection System",{"id":184,"depth":302,"text":308,"children":309},"Method II - Sobel-Kernel Detection System",[310,312,313,314],{"id":202,"depth":311,"text":203},3,{"id":222,"depth":311,"text":223},{"id":250,"depth":311,"text":251},{"id":257,"depth":311,"text":258},{"id":264,"depth":302,"text":265},{"id":283,"depth":302,"text":284},"2025-10-23","A simple microfluidics gradient analyzer I wrote in R to analyze gradients in microfluidic devices under different flow rates. ","md","https:\u002F\u002Fcdn.the-scientist.com\u002Fassets\u002FarticleNo\u002F71667\u002FhImg\u002F52223\u002Fmicrofluidics-biology-s-liquid-revolution-1800x720-x.webp",{},true,"\u002Fprojects\u002Fmicrofluidics-gradient-analyzer",{"repoUsername":325,"repoName":326},"ansonzhang2009","MicrofluidicsGradientAnalysis",{"title":5,"description":318},"projects\u002Fmicrofluidics-gradient-analyzer",[330,331],"ESAP","Analysis","iuHN04Dexyl8XsuCtO4Fo3w5eS7jSX9gznh7Z80l2MA",[334,335],null,{"title":336,"path":337,"stem":338,"children":-1},"Wireless Motion Controlled Side Show Clicker","\u002Fprojects\u002Fwireless-motion-controlled-slide-show-clicker","projects\u002Fwireless-motion-controlled-slide-show-clicker",1777421406171]