thiago-glissoi / FFF-Line-Segmentation

The fff_segmenter algorithm is used to segment an acoustic signal obtained from a first layer 3D print into multiple acoustic blocks related to specific geometrical elements of the printed part, such as contour lines, raster lines, and transition between raster lines.
MIT License
0 stars 0 forks source link

Definition

The fff_segmenter algorithm is used to segment a acoustic signal obtained from a first layer 3D print into multiple acoustic blocks related to specific geometrical elements of the printed part, such as contour lines, raster lines, and transition between raster lines. The fff_segmenter algorithm uses the direction control signal of the X and Y axis stepper motors. In order to use the fff_segmenter algorithm, the acoustic signal must be collected synchronously with the X and Y direction control signals at a specified sampling frequency. The folder Data presents three datasets of signals collected from a first layer 3D print. We strongly encourage the user to read the Documentation pdf file in order to completely comprehend the fff_segmenter algorithm inner workings, and how it was built with a specific part geometry and sampling frequency in consideration.

Clone the repository

git clone https://github.com/thiago-glissoi/FFF-Line-Segmentation.git

Dependencies

Before using the fff_segmenter script, verify if the following dependencies are installed and available in your Matlab or Octave environment.

Matlab dependencies -> [Signal Processing Toolbox](https://www.mathworks.com/products/signal.html)

Octave dependencies -> [Signal Package](https://octave.sourceforge.io/signal/) -> [Control Package](https://octave.sourceforge.io/control/)

How to use

Verify the example for Matlab or for Octave.

Matlab example Make sure that the listed [Dependencies](#Dependencies) are installed and loaded into Matlab. Run the `fff_segmenter` script by typing directly into the command window followed by the press of the Enter key on the keyboard, or by clicking in the run button of the Matlab text editor. ```Matlab fff_segmenter ``` After running the fff_segmenter algorithm, the user will be presented with the graphical interface displayed below. In the graphical interface: - The user must use the `Select data` button to select the .mat file which contains the acoustic signal and the X and Y direction control signals. - The user must insert the `Sampling frequency` of the signals in Hertz (Hz). - The user must insert the name of the sensor signal that exists in the selected .mat file on the `Raw signal identification` field. - The user must insert the name of the direction X axis signal that exists in the selected .mat file on the `DirX identification` field. - The user must insert the name of the direction Y axis signal that exists in the selected .mat file on the `DirY identification` field. - The user must select the `Segmentation mode` between `Points` and `Segments`. If the choice is not made, the default `Points` mode will be utilized. - The user must select the `Unit` segmentation between `Number of samples` and `Seconds`. If the choice is not made, the default `Number of samples` mode will be utilized. - The user may select additional `Outputs` that can be generated by the algorithm. The available outputs are `Obtain graphical visualization`, `Save graphical visualization if obtained`, and `Obtain automatic .mat files`. If none additional `Outputs` are selected, the `fff_segmenter` function output will only be the segmentation results to the current Matlab workspace. About the additional outputs: - The `Obtain graphical visualization` option will generate a figure with the segmentation results displayed on top of the `Sensor signal`. - The `Save graphical visualization if obtained` option will save the generated figure in the `Segmentation results` folder. - The `Obtain automatic .mat files` option will save the segmentation results in the `Segmentation results` folder in .mat format. The output data file name follows a definition that is based on the `Segmentation mode` choice, and the identification of the sensor signal in the dataset. Figure 1 - Input interface For the purpose of this example, the `Select data` button will be used to load the `Test1.mat` file from the `Data` folder. The `Select data` button will open a file explorer window, where the user can navigate to the `Data` folder and select the `Test1.mat` file. The rest of the input fields will be filled with the values in regard to the `Test1.mat` dataset, with default values for the `Segmentation mode` and `Unit` segmentation options, and with all of the available outputs toggled to `Yes`. Figure 2 - Input interface filled with values When the user toggle to `On` the `Run the segmentation` button, the graphical input interface will be closed and the fff_segmentation algorithm will run with the defined parameters. As a result of running the fff_segmentation algorithm with default parameters, two new files were generated in the ```Segmentation results``` folder, which was created in the Matlab's current path. The first, named `Points segmentation results Acoustic_signal`, holds the results of the segmentation in the `Points` segmentation choice, saved in table format. The output data file name follows a definition that is based on the `Segmentation mode` choice, in this case `Points`, and the identification of the sensor signal in the dataset, in this case `Acoustic_signal`. The figure below demonstrate the contents of the [Points segmentation results Acoustic_signal]() in the Matlab workspace. Figure 3 - Points segmentation results in the workspace Opening each table in Matlab, it is possible to observe that the point segmentation mode generates three columns for each geometric feature, and two columns for the pattern's separation. In regard to the geometric features tables, the first column is the ```Duration``` of the feature fabrication, the second column is the first instant index, identified as ```StartPoint```, of the feature fabrication, and the third column is the ```EndPoint``` of the feature fabrication in the default number of samples mode. ![Figure 4 - Points segmentation results](Example/Matlab%20Segmentation%20index%20mode%20results.png) The second file, named `Segmentation results Acoustic_signal`, is the automatically saved figure with the predetermined resolution and formatting. The image obtained for this example is represented in the figure below. ![Figure 5 - Saved figure](Example/Matlab%20Segmentation%20results%20'Test1'.png)
Octave example Make sure that the listed [Dependencies](#Dependencies) are installed and loaded into Octave. Run the `fff_segmenter` script by typing directly into the command window followed by the press of the Enter on the keyboard, or by clicking in the run button of the Octave text editor. ```Octave fff_segmenter ``` After running the fff_segmenter algorithm, a file explorer window will appear. - The user must select the .mat file which contains the acoustic signal and the X and Y direction control signals. For the purpose of this example, the user can navigate to the `Data` folder and select the `Test1.mat` file. Figure 6 - Octave file selection After selecting the data file, the user will be presented with the graphical interface displayed below. The filled values in the input fields are the default values for the `Segmentation mode` and `Unit` segmentation options, and with all of the available fields set to `N`. In the graphical interface: - The user must insert the name of the sensor signal that exists in the selected .mat file on the `Sensor signal identification` field. - The user must insert the name of the direction X axis signal that exists in the selected .mat file on the `X-axis signal identification` field. - The user must insert the name of the direction Y axis signal that exists in the selected .mat file on the `Y-axis signal identification` field. - The user must insert the `Sampling frequency` of the signals in Hertz (Hz). - The user must select the `Segmentation mode` between `Points` and `Segments`. If the choice is not made, the default `Points` mode will be utilized. - The user must select the `Unit` segmentation between `Number of samples` and `Seconds`. If the choice is not made, the default `Number of samples` mode will be utilized. - The user may select additional `Outputs` that can be generated by the algorithm. The available outputs are `Generate figure`, `Save figure`, and `Auto save files`. If none additional `Outputs` are selected, the `fff_segmenter` function output will only be the segmentation results to the current Octave workspace. About the additional outputs: - The `Generate figure` option will generate a figure with the segmentation results displayed on top of the `Sensor signal`. - The `Save figure` option will save the generated figure in the `Segmentation results` folder. - The `Auto save files` option will save the segmentation results in the `Segmentation results` folder in .mat format. The output data file name follows a definition that is based on the `Segmentation mode` choice, and the identification of the sensor signal in the dataset. Figure 7 - Octave Input GUI The user will fill the fields with the values in regard to the `Test1.mat` dataset, with default values for the `Segmentation mode` and `Unit` segmentation options, and with all of the available fields set to `Y`. Figure 8 - Octave Input GUI filled When the the user press `Enter` on the keyboard, the graphical input interface will be closed and the fff_segmentation algorithm will run with the defined parameters. As a result of running the fff_segmentation algorithm with default parameters, two new files were generated in the ```Segmentation results``` folder, which was created in the Octave's current path. The first, named `Points segmentation results Acoustic_signal`, holds the results of the segmentation in the `Points` segmentation choice, saved in struct format. The output data file name follows a definition that is based on the `Segmentation mode` choice, in this case `Points`, and the identification of the sensor signal in the dataset, in this case `Acoustic_signal`. The figure below demonstrate the contents of the `Points segmentation results Acoustic_signal` in the Octave workspace. Figure 9 - Points segmentation results in the workspace Opening each struct in Octave, it is possible to observe that the point segmentation mode generates three columns for each geometric feature, and two columns for the pattern's separation. In regard to the geometric features tables, the first column is the ```Duration``` of the feature fabrication, the second column is the first instant index, identified as ```StartPoint```, of the feature fabrication, and the third column is the ```EndPoint``` of the feature fabrication in the default number of samples mode. ![Figure 10 - Points segmentation results](Example/Octave%20Segmentation%20index%20mode%20results.png) The second file, named `Segmentation results Acoustic_signal`, is the automatically saved figure with the predetermined resolution and formatting. The image obtained for this example is represented in the figure below. ![Figure 11 - Saved figure](Example/Octave%20Segmentation%20results%20'Test1'.png)

Application example

As a result of using the fff_segmenter algorithm, the user now possess the ability to more precisely examine the acoustic signal of the FFF fabrication in specified moments. An example of such application is represented in Figure 4, where the frequency content of the complete acoustic signal is represented in comparison to the frequency content of the acoustic signal related to just the middle raster line of the internal infill pattern fabrication period.

Figure 12 - Application example

Community Guidelines

Our community is dedicated to providing a welcoming and productive environment for all participants. Please follow these guidelines when interacting with this project.

  1. We again strongly encourage the user to read the Documentation pdf file in order to completely comprehend the fff_segmenter algorithm inner workings, and how it was built with a specific part geometry and sampling frequency in consideration. The documentation also provides some examples on how the fff_segmenter can be further developed to cater to other FFF printers and parts geometries.

  2. Contributing to the Software Contributions are welcome! Here are some ways to contribute:

  1. Reporting Issues or Problems with the Software If you encounter an issue or bug, please follow these steps:
  1. Seeking Support For questions or support needs:

Code of Conduct

By participating in this project, we ask that everyone follows our Code of Conduct, which sets expectations for behavior to maintain a welcoming and inclusive community.