ITK  5.4.0
Insight Toolkit
SphinxExamples/src/IO/ImageBase/CreateAListOfFileNames/Code.py
1 #!/usr/bin/env python
2 
3 # Copyright NumFOCUS
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # https://www.apache.org/licenses/LICENSE-2.0.txt
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 import itk
18 
19 numeric_series_file_names = itk.NumericSeriesFileNames.New(
20  start_index=0, end_index=150, increment_index=10, series_format="output_%d.png"
21 )
22 
23 file_names = numeric_series_file_names.GetFileNames()
24 
25 for file_name in file_names:
26  print(file_name)
27 
28 print()
29 print("***************")
30 print()
31 
32 numeric_series_file_names.SetSeriesFormat("output_%04d.png")
33 
34 file_names = numeric_series_file_names.GetFileNames()
35 
36 for file_name in file_names:
37  print(file_name)
itk::NumericSeriesFileNames::New
static Pointer New()