Question

selection of files with specific string in filename


Badge +7

Hello

 

I have five raster images from one point, which differ only in the recording direction. From these images I would like to create an overview image from their center parts. For this reason I cut out a subset from the middle of all five images. These 5 small pictures I would like to put together now by via RasterMosaicker in one picture. If I try this on a single example, it works perfectly.

However, I can't do it if all the shots are to be applied over the entire project. Specifically, I don't manage to hand over the selection of the five related images to the RasterMosaicker. The five recordings can be selected using the same substring in the file name. So my question is, how can I select the corresponding files in FME from a large number of files?

Thanks a lot.

 


7 replies

Userlevel 4
Badge +26

Create a new attribute using the SubStringExtracter from the fme_basename attribute. This new attribute you can use in the Group By field in the RasterMosaicker.

 

 

Each of the images going into the RasterMosaicker must have the same attribute name.

 

 

If you want to instead run this process in batch then you should check out the WorkspaceRunner (https://knowledge.safe.com/articles/1469/batch-processing-using-the-workspacerunner-1.html )
Badge +7

Thanks a lot for your fast answer.

Unfortunately, I don't get the result I want. I tried both the "Group By" option and the "Input Ordered" function with the RasterMosaicker. As a result I always get only one image, although I should get several overview images. In the attached workbench is my current script, in which I process only one image row of a point. This works as desired.

If I capture several images from different recording points with all readers (this is extracted in the SubstringExtrator before the RasterMosaicker and written into the variable "_substring") I also get only one image. Unfortunately I now have no idea how to provide the script with the corresponding images as input.

 

rastertiling_allcentersintoone_v1.06-3x3.fmw

Userlevel 4
Badge +26

Thanks a lot for your fast answer.

Unfortunately, I don't get the result I want. I tried both the "Group By" option and the "Input Ordered" function with the RasterMosaicker. As a result I always get only one image, although I should get several overview images. In the attached workbench is my current script, in which I process only one image row of a point. This works as desired.

If I capture several images from different recording points with all readers (this is extracted in the SubstringExtrator before the RasterMosaicker and written into the variable "_substring") I also get only one image. Unfortunately I now have no idea how to provide the script with the corresponding images as input.

 

rastertiling_allcentersintoone_v1.06-3x3.fmw

Would you be able to upload a few of the images for testing with?

Badge +7

Would you be able to upload a few of the images for testing with?

Hi Matt, thanks a lot for taking time of my issue. I attached a sample data set (as *.jpg).

This data set contains the images from 4 different recording points with the corresponding 5 images. The different recording directions (B, F, L, R, N) can be recognized by the first characters of the file name. The different recording points with the help of the following character string (e.g. *_10-42-06.870_*). Currently, all recording directions are located in separate directories. You can easily change this and copy all data into a single directory, for example. The aim of the script appended in the previous answer is to cut out the center of all images with the same capture point (e.g. *_10-42-06.870_*) and visualize these 5 center image parts in a new image.

 

At the moment I can only create the image if I preselect all 5 images of a recording point with the 5 different image readers. If I tried to do this task with the entire data set (different recording points) at once, I unfortunately only got one image.

I tried this with the WorkspaceRunner and SubstringExtractor, without any sucess. 8-(

 

Thanks a lto

 

 

jpg.zip

Badge +10

Hi Matt, thanks a lot for taking time of my issue. I attached a sample data set (as *.jpg).

This data set contains the images from 4 different recording points with the corresponding 5 images. The different recording directions (B, F, L, R, N) can be recognized by the first characters of the file name. The different recording points with the help of the following character string (e.g. *_10-42-06.870_*). Currently, all recording directions are located in separate directories. You can easily change this and copy all data into a single directory, for example. The aim of the script appended in the previous answer is to cut out the center of all images with the same capture point (e.g. *_10-42-06.870_*) and visualize these 5 center image parts in a new image.

 

At the moment I can only create the image if I preselect all 5 images of a recording point with the 5 different image readers. If I tried to do this task with the entire data set (different recording points) at once, I unfortunately only got one image.

I tried this with the WorkspaceRunner and SubstringExtractor, without any sucess. 8-(

 

Thanks a lto

 

 

jpg.zip

You need to use the substring you've extracted from the basename in the rastermosaicker. This will then remain available to use, you don't need the second substring extractor.

 

You've also got an issue with setting Ausrichter_X as you've got arithmetic expressions in the text editor

Badge +7

You need to use the substring you've extracted from the basename in the rastermosaicker. This will then remain available to use, you don't need the second substring extractor.

 

You've also got an issue with setting Ausrichter_X as you've got arithmetic expressions in the text editor

Thank you very much for the quick answer. As far as I can see with my test dataset, it now works as I would like it to. Maybe a stupid question, but is there a limitation (number of files to process or file size) on the "Group by" function?

Badge +2

Thank you very much for the quick answer. As far as I can see with my test dataset, it now works as I would like it to. Maybe a stupid question, but is there a limitation (number of files to process or file size) on the "Group by" function?

Hi @alfons,

The only limitations would be potential memory concerns but that depends on the size of the dataset and available computer resources. You can learn more about this in the About Group Based Transformers documentation.

Hope this helps :)

Reply